Repository navigation
README: a program started in its parent's first moment can miss the Job Object - #52
Merged
Merged
Conversation
…ob Object Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What was wrong: the README promises "programs the script started die with it, even if it's force-closed". But a program is assigned to the kit's kill-on-close Job Object only after
Process.Startreturns. A child it starts in that window, such astool.exeundercmd /c tool.exe, isn't in the Job Object, so if the script is killed outright that child keeps running.What changed: README only. A Limits entry describes the gap and how rare it was in testing, the "No orphans" bullet and the force-close FAQ answer point to it. Ctrl+C, an abort and a timeout aren't affected: they kill each program's whole tree with taskkill. The kit isn't changed. Adding PowerShell's own process to the Job Object would close the gap, but it would also kill anything else the script starts on purpose, such as an app it opens.
Tested (reproduced): a child PowerShell started 200
cmd /c pingtrees throughStart-PkProcessand was then killed withStop-Process -Force. Over three runs per runtime, 1 of 600 pings survived on Windows PowerShell 5.1 and none of 600 on PowerShell 7. A separate probe withIsProcessInJobfound 1 of 200 pings outside the Job Object on 5.1 with no load, and none of 300 with every core busy, on either runtime.🤖 Generated with Claude Code