Repository navigation
Refuse time limits that can't work: NaN/Infinity -TimeoutSeconds and negative waits - #63
Merged
Merged
Conversation
…ative waits -TimeoutSeconds on the batch and dispatcher only checked `-lt 0`, so NaN and +Infinity passed and acted as no limit, while a job's own TimeoutSeconds key refuses both. Negative waits weren't refused anywhere: -StreamTimeoutMs -1 and Wait-PkProcess -TimeoutMs -1 waited without limit, -2 failed later with .NET's own message, and a negative -AbortTimeoutSeconds / -DrainTimeoutSeconds acted as 0. All are now refused before anything starts, with a message naming the command and parameter. 0 keeps its meaning (no limit, or don't wait). The batch's and dispatcher's twin checks name each other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… help 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.
Several time-limit parameters took values that can't work, and failed late or not at all:
-TimeoutSecondsonInvoke-PkProcessBatchandInvoke-PkProcessDispatchtook NaN and +Infinity. Both only checked-lt 0, so these passed and acted as no limit, while a job's ownTimeoutSecondskey already refuses both.-StreamTimeoutMs -1(Complete-PkProcess,Invoke-PkProcessWithTimeout) waited until a leftover child let go of the output, forever if it never did, and-2came back later as aStreamError.Wait-PkProcess -TimeoutMs -1waited until the program exited, against its "can't overrun" purpose, and-2threw .NET's raw message. A negative-AbortTimeoutSeconds/-DrainTimeoutSecondson any engine silently acted as 0.What changed
Each of these is now refused before anything starts, with a message that names the command and parameter and says what the value means, e.g.
Complete-PkProcess: -StreamTimeoutMs must be 0 or more (got -1). It's how long to wait for the output after the program exits, in milliseconds; 0 doesn't wait.0 keeps its meaning everywhere (no limit, don't wait, or just check). The help for the wait parameters says "0 or more". The batch's and dispatcher's twin checks, and the job-key check inGet-PkJobTimeLimit, now name each other.Scripts that passed one of these values get an error now instead of the old behavior.
Testing
-TimeoutSecondson the batch and dispatcher;-5for-AbortTimeoutSeconds(batch, dispatcher) and-DrainTimeoutSeconds(runspace jobs);-1for-StreamTimeoutMs(both commands) andWait-PkProcess -TimeoutMs. All ten failed on the old code (no error) and pass now; a separate check confirms 0 is still accepted for each.🤖 Generated with Claude Code