Repository navigation
Harness: tests for stream timeouts, leaks, hard kills, start-path parity and throwing callbacks - #60
Merged
Merged
Conversation
…-path parity and throwing callbacks Tests of behavior the README promises but nothing checked, all passing on today's code: - a leftover child holding the output past -StreamTimeoutMs sets StreamTimedOut (Complete-PkProcess, Invoke-PkProcessWithTimeout) - repeated starts (both start paths), batches and runspace runs don't grow handles, threads or runspaces once warmed up - PowerShell killed outright leaves none of its programs running, on both start paths - creating a program inside the Job Object and the Process.Start fallback give the same exit codes, output, environment and working folder - a dispatcher or runspace callback that throws while programs run lets the exception out, leaves nothing running and returns shared slots Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Start the fallback's long ping a second after cmd.exe (the documented fallback race), bound the throwing-callback cases with a time limit, and report a missing program output as a failure instead of stopping the run. 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 things the README promises had no test, so a regression in them would have shipped green. This adds harness tests for them; all pass on the current code, and nothing in the kit changes.
What changed
StreamTimedOut. Only its existence and$falsevalue were checked. Now acmd /cwhosestart /bchild holds the output pipe past-StreamTimeoutMs 1000must come back withStreamTimedOut = $trueafter about a second, throughComplete-PkProcessandInvoke-PkProcessWithTimeout.Get-Runspacecount where they were. The handle count jumps by a few hundred and back between runs on both runtimes (a bareRunspacePooldoes the same), so each side is the lowest of 20 readings. For the runspace engine only threads and runspaces are checked: its handle noise is as large as any leak worth catching.cmd /c pingjobs and is killed withStop-Process -Force; none of the pings may survive. Run on both start paths (created inside the Job Object, and theProcess.Startfallback).-PollCallback,-GroupCompleteCallback,-JobBuilder,-GroupProviderand-GroupReleaseCheckon the dispatcher, each throwing while a program runs: the exception comes out, no program is left running, and a sharedSemaphoreSlimgets every slot back. For-ResultHandler,-PollCallbackand-NextJobProvideron the runspace engine, each throwing while two workers run: the exception comes out and the workers' runspaces close.Testing
Full harness passes in fresh processes on Windows PowerShell 5.1 and PowerShell 7 (505 assertions each). The new sections add about 30 s per runtime. The leak section was also run three times on each runtime on its own, and passed every time.
🤖 Generated with Claude Code