fix: preserve taskkill flags under Git Bash#411
Conversation
rajpratham1
left a comment
There was a problem hiding this comment.
This is a focused, low-risk fix for a real Windows/MSYS compatibility issue.
Why it looks correct
It introduces:
envWithoutMsysPathConversion()
which sets:
MSYS_NO_PATHCONV=1
MSYS2_ARG_CONV_EXCL=*
These are the standard environment variables used to disable Git Bash/MSYS argument rewriting.
Previously:
taskkill /PID 1234 /T /F
could be rewritten by Git Bash, causing /PID and /T to be interpreted as paths instead of switches.
Now only the taskkill invocation receives the modified environment:
env: envWithoutMsysPathConversion(options.env)
so the change is isolated and doesn't affect other commands.
Test quality
The updated test verifies:
Windows platform
Git Bash (SHELL=...bash.exe)
existing environment variables are preserved
MSYS_NO_PATHCONV
MSYS2_ARG_CONV_EXCL
correct taskkill arguments
This is exactly the regression that needed coverage.
Risk
Very low.
The environment override applies only to the Windows taskkill execution and preserves the caller's existing environment.
Minor suggestion
envWithoutMsysPathConversion() could avoid recreating the environment if the variables are already set, but this is purely an optimization.
Summary
taskkillprocess-tree cleanup call/PID,/T, and/Fwhen Claude Code is launched from Git Bash/MSYSAddresses #331. Related to #409.
Tests
node --test tests\process.test.mjsgit diff --checkNot run: full
npm.cmd testtimed out locally on Windows while runtime broker fixtures kept running; this change is covered by the focused process helper test.