Merge pull request #2645 from QwenLM/fix/git_bash_change_windows
Some checks are pending
Qwen Code CI / Lint (push) Waiting to run
Qwen Code CI / Test (push) Blocked by required conditions
Qwen Code CI / Test-1 (push) Blocked by required conditions
Qwen Code CI / Test-2 (push) Blocked by required conditions
Qwen Code CI / Test-3 (push) Blocked by required conditions
Qwen Code CI / Test-4 (push) Blocked by required conditions
Qwen Code CI / Test-5 (push) Blocked by required conditions
Qwen Code CI / Test-6 (push) Blocked by required conditions
Qwen Code CI / Test-7 (push) Blocked by required conditions
Qwen Code CI / Test-8 (push) Blocked by required conditions
Qwen Code CI / Post Coverage Comment (push) Blocked by required conditions
Qwen Code CI / CodeQL (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none (push) Waiting to run
E2E Tests / E2E Test - macOS (push) Waiting to run

fix(windows): support git bash/MSYS2 shell detection on Windows
This commit is contained in:
DennisYu07 2026-03-26 13:04:38 +08:00 committed by GitHub
commit db7ec117c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 110 additions and 0 deletions

View file

@ -19,6 +19,19 @@ import type { PromptPipelineContent } from './types.js';
// mirroring the logic in the actual `escapeShellArg` implementation.
function getExpectedEscapedArgForPlatform(arg: string): string {
if (os.platform() === 'win32') {
// Detect Git Bash / MSYS2 / MinTTY environments (same logic as getShellConfiguration)
const msystem = process.env['MSYSTEM'];
const term = process.env['TERM'] || '';
const isGitBash =
msystem?.startsWith('MINGW') ||
msystem?.startsWith('MSYS') ||
term.includes('msys') ||
term.includes('cygwin');
if (isGitBash) {
return quote([arg]);
}
const comSpec = (process.env['ComSpec'] || 'cmd.exe').toLowerCase();
const isPowerShell =
comSpec.endsWith('powershell.exe') || comSpec.endsWith('pwsh.exe');