(envShell: string)
| 115 | } |
| 116 | |
| 117 | function looksLikeWslShell(envShell: string): boolean { |
| 118 | // WSL (and other Unix-like environments) often surface POSIX-y paths like `/bin/bash`. |
| 119 | // Those paths don't exist on Windows hosts, so treat them as WSL and ignore. |
| 120 | if (envShell.startsWith("/")) { |
| 121 | return true; |
| 122 | } |
| 123 | |
| 124 | const normalized = envShell.replace(/\//g, "\\").toLowerCase(); |
| 125 | const base = path.win32.basename(normalized); |
| 126 | return ( |
| 127 | normalized === "wsl" || |
| 128 | base === "wsl.exe" || |
| 129 | normalized === "bash" || |
| 130 | normalized === "bash.exe" || |
| 131 | normalized.endsWith("\\windows\\system32\\bash.exe") |
| 132 | ); |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * Resolve the best shell to use for a *local* PTY session. |
no test coverage detected