Repository navigation
Keep output that arrived before a stream timeout, per stream - #66
Merged
Merged
Conversation
When a program a program started held stdout or stderr open past -StreamTimeoutMs, that stream came back $null: ReadToEndAsync has nothing to give until the stream ends, so a build step whose helper outlived it lost its whole log. The output is now read in chunks (PkStreamReadTask, a Task<string> whose text so far can be taken at any time, under a lock), on both start paths. On a timeout each stream comes back with what had arrived: the held one cut short, the other whole. The reader's decoder keeps a character split across reads for the next one, so the cut never breaks a character. The read carries on until the holder lets go of the pipe, at the latest when PowerShell exits (the holder is in the Job Object). StdoutTask and StderrTask are still Task<string>. The start result's four keys and their two copies (the dispatcher's and the batch's starters) now name each other. 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.
When a program a program started (a compiler server, say) kept stdout or stderr open past
-StreamTimeoutMs,StreamTimedOutwas set as designed, but that stream came back$null:ReadToEndAsynchas nothing to give until the stream ends. A build step whose helper outlived it lost its whole log, not just the end of it.What changed
PkStreamReadTask, aTask<string>whose text so far can be taken at any time, under a lock against the reader still appending. Used on both start paths (created in the Job Object, and theProcess.Startfallback).Complete-PkProcessgives each stream what had arrived: the held one cut short, the other whole.StreamTimedOutstill means either stream timed out.Complete-PkProcess.StdoutTaskandStderrTaskare stillTask<string>(a subclass), so code reading.Resultworks as before. A finished reader drops its buffer, so the text isn't held twice.One side effect: on PowerShell 7 the reads now block a thread-pool thread per stream, as they always did on 5.1. The kit already raises the pool's minimum for that.
The compiled types changed again (types version 7), so start a new PowerShell window after updating.
Testing
start /band even .NET'sProcess.Starthand a child both):🤖 Generated with Claude Code