Repository navigation
fix: kill the Windows cmd.exe shim process tree - #344
Merged
Merged
Conversation
child.kill() and execFile's timeout stop only cmd.exe. A patchloom.cmd launch therefore leaves the real CLI running after Verify MCP finishes or a command times out. Kill those shims with taskkill /T /F. If taskkill is missing or exits non-zero, fall back to child.kill(). Direct patchloom.exe launches still use child.kill(). A Windows test starts ping under cmd.exe /c and checks the grandchild is gone. npm run check passed (470 tests). Signed-off-by: Sebastien Tardif <SebTardif@ncf.ca>
Comment on lines
+99
to
+114
| const child = execFile(launch.file, launch.args, { | ||
| ...execOptions, | ||
| encoding: "utf8", | ||
| shell: launch.shell, | ||
| windowsVerbatimArguments: launch.windowsVerbatimArguments | ||
| }, (error, stdout, stderr) => { | ||
| disarm(); | ||
| if (error) { | ||
| reject(error); | ||
| return; | ||
| } | ||
| resolve({ | ||
| stdout: typeof stdout === "string" ? stdout : "", | ||
| stderr: typeof stderr === "string" ? stderr : "" | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stop Windows
patchloom.cmdlaunches by killing the process tree.child.kill()only stopscmd.exe, so the real CLI could keep running after Verify MCP or a timed-out command.Why
patchloomLaunchruns.cmdand.batshims ascmd.exe /d /s /c. Node's kill andexecFiletimeout do not kill that grandchild. Verify MCP kills its child when the probe finishes, including on success.taskkill /T /Fstops the tree. A non-zerotaskkillexit, or a missingtaskkill.exe, falls back tochild.kill(). A directpatchloom.exestill useschild.kill().Verification
npm run checkpassed: 470 tests, coverage, andvsce package.killPatchloomChildstoppedping.exestarted undercmd.exe /c.taskkilldid not fall back tochild.kill(). That fallback is in this commit, with a unit test.Checklist
git commit -snpm run checkand it passes