Qwen Code
Partial MSYSTEM/TERM sniffing + Git Bash path lookup (its own) Windows macOS Linux Difficulty Medium
After forking gemini-cli it grew its own MSYSTEM/TERM sniffing and Git Bash lookup — set MSYSTEM=MINGW64 (experimental) to hit the installer-placed bash launcher.
PowerShell · set MSYSTEM (experimental — see notes)
[Environment]::SetEnvironmentVariable('MSYSTEM', 'MINGW64', 'User') Steps
- Run the command above to persist MSYSTEM=MINGW64 to the user environment; reopen the terminal to take effect
- Once Qwen Code's isGitBash branch hits, it looks for bash.exe along PATH → C:\Program Files\Git\bin\bash.exe — the latter is placed by the niubash installer, so a hit routes through the launcher into niu
Verify
echo $MSYSTEM; echo "SHELL=$SHELL"; uname -s — MSYSTEM=MINGW64 and uname reporting MSYS_NT- means the bash branch was taken
Rollback
[Environment]::SetEnvironmentVariable('MSYSTEM', $null, 'User') Notes & pitfalls
- Source-verified (2026-10-21 HEAD, QwenLM/qwen-code packages/core/src/utils/shell-utils.ts getShellConfiguration()): MSYSTEM prefixed MINGW/MSYS, or TERM containing msys/cygwin → findGitBashPath() (scan PATH for bash.exe → the two hard-coded Program Files paths); otherwise falls back to ComSpec (cmd/PowerShell)
- Unlike upstream Gemini CLI's "unconditional PowerShell": Qwen Code forked from gemini-cli v0.8.2 (stated in the README acknowledgments) and has evolved independently since v0.1 — the two integration states do not transfer
- agents.md trap clause: MSYSTEM is empty by default inside a niu session; setting it is an untested experiment and changes how other MSYS-aware tools behave
- A read-the-code conclusion, not machine-tested; can be promoted to ready once machine-tested
Sources
QwenLM/qwen-code packages/core/src/utils/shell-utils.ts(getShellConfiguration / findGitBashPath)qwen-code README(gemini-cli v0.8.2 分叉声明)agents.md「Known traps」(MSYSTEM)- agents.md (the complete probe-mechanism document) ↗
Chinese edition of this page: /agents/qwen-code/