Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,28 @@ shell = '"C:\Program Files\Git\bin\bash.exe" -c'

(On macOS/Linux, `shell` follows POSIX quoting rules instead.)

#### Cygwin

Comment thread
greptile-apps[bot] marked this conversation as resolved.
mise also detects Cygwin bash (by a `cygwin` / `cygwin64` / `cygwin32` segment in its path) and
converts PATH using Cygwin's `/cygdrive/c/...` form instead of Git Bash's `/c/...`,
so binaries on PATH resolve correctly. Point `MISE_BASH_PATH` at your Cygwin bash so
the intended one is used:

```powershell
$env:MISE_BASH_PATH = "C:\cygwin64\bin\bash.exe"
```

If you changed the `cygdrive` prefix in `/etc/fstab` (the default is `/cygdrive`),
set `MISE_CYGDRIVE_PREFIX` to match — mise does not read `/etc/fstab`:

```powershell
# e.g. for an fstab that mounts drives under /mnt
$env:MISE_CYGDRIVE_PREFIX = "/mnt"
```

The prefix must be absolute (start with `/`); a relative value like `mnt` is rejected
with a warning and the default `/cygdrive` is used instead.

## mise isn't working when calling from tmux or another shell initialization script

`mise activate` will not update PATH until the shell prompt is displayed. So if you need to access a
Expand Down
62 changes: 62 additions & 0 deletions e2e-win/task.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,66 @@ esac
Remove-Item -Path "$TestDrive\mise.path_repro.toml" -ErrorAction SilentlyContinue
}
}

It 'converts PATH to /cygdrive form for a Cygwin bash subshell task' {
# Cygwin resolves drives via `/cygdrive/c/...`, not Git Bash's `/c/...`.
# When mise detects a Cygwin bash (here pinned via MISE_BASH_PATH), the
# task's PATH must use the `/cygdrive/` form or commands won't resolve.
# Skipped unless Cygwin is actually installed, since CI runners lack it.

$cygwinBash = "C:\cygwin64\bin\bash.exe"
if (-not (Test-Path $cygwinBash)) {
Set-ItResult -Skipped -Because "Cygwin bash not installed at $cygwinBash"
return
}

@'
[tasks.cygdrive_repro]
shell = "bash -c"
run = '''
case "$PATH" in
*/cygdrive/*)
echo "PATH-cygdrive-style"
;;
*)
echo "PATH-not-cygdrive"
;;
esac
'''
'@ | Out-File -FilePath "mise.cygdrive_repro.toml" -Encoding utf8NoBOM

# Save and restore the env vars we override so a dev machine's real
# settings (a developer may export MISE_BASH_PATH / MISE_CYGDRIVE_PREFIX)
# and later tests are not disturbed. Pin MISE_CYGDRIVE_PREFIX to the
# default so the `/cygdrive` assertion holds even when the caller has
# exported a custom prefix such as `/mnt` (which the feature honors).
$oldConfig = $env:MISE_CONFIG_FILE
$oldBashPath = $env:MISE_BASH_PATH
$oldCygPrefix = $env:MISE_CYGDRIVE_PREFIX
$env:MISE_CONFIG_FILE = "$TestDrive\mise.cygdrive_repro.toml"
$env:MISE_BASH_PATH = $cygwinBash
$env:MISE_CYGDRIVE_PREFIX = "/cygdrive"
try {
$output = mise run cygdrive_repro 2>&1 | Select -Last 1
$output | Should -Be 'PATH-cygdrive-style'
}
finally {
if ($null -eq $oldConfig) {
Remove-Item -Path Env:\MISE_CONFIG_FILE -ErrorAction SilentlyContinue
} else {
$env:MISE_CONFIG_FILE = $oldConfig
}
if ($null -eq $oldBashPath) {
Remove-Item -Path Env:\MISE_BASH_PATH -ErrorAction SilentlyContinue
} else {
$env:MISE_BASH_PATH = $oldBashPath
}
if ($null -eq $oldCygPrefix) {
Remove-Item -Path Env:\MISE_CYGDRIVE_PREFIX -ErrorAction SilentlyContinue
} else {
$env:MISE_CYGDRIVE_PREFIX = $oldCygPrefix
}
Remove-Item -Path "$TestDrive\mise.cygdrive_repro.toml" -ErrorAction SilentlyContinue
}
}
}
Loading
Loading