Repository navigation
Invoke-PkProcessBatch: add -TimeoutSeconds - #9
Merged
Merged
Conversation
A program that hung held its batch slot until it exited or the run was aborted; the only way round it was dropping down to the dispatcher. -TimeoutSeconds kills a program still running after that long. Its result gets TimedOut = $true (a new field on every batch result) and still goes through -OnComplete; the rest of the batch carries on. 0, the default, means no limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eal kill Killing only the program left any programs it started running and holding its output open, so collecting its result waited the full 15s stream timeout on the main thread. New Stop-PkProcessTree kills the tree with taskkill /T, falling back to Process.Kill. TimedOut was set before the kill, so a program that exited on its own right at the deadline was reported as timed out. It's now set only if the kill actually happened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Invoke-PkProcessBatchhad no per-program time limit: a program that hung held its slot until it exited or the run was aborted. The README's only workaround was to drop down toInvoke-PkProcessDispatchand write a-JobPollCompletedcheck by hand.What changed.
-TimeoutSeconds(default 0 = no limit) kills a program still running after that long, using the dispatcher's-JobPollCompletedand the stopwatchStart-PkProcessalready returns. Every batch result gets a newTimedOutfield, set in all three places a result is built. A timed-out program goes through-OnCompletelike any other, and the rest of the batch carries on. A negative value is refused. README: the result field list, a paragraph on the option, and the Limits bullet now says only the dispatcher lacks a limit.Testing. New assertions:
ping -n 30in a batch with-TimeoutSeconds 2is killed in about 2s and markedTimedOut, while a fast command in the same batch finishes normally.-OnComplete.TimedOut.These fail against
main(no such parameter or field). 183 assertions pass on 5.1.🤖 Generated with Claude Code