Delete the three-space branch from the ps parser - #806
Merged
Conversation
`ps -o pid,command` has exactly one separator, so everything after the first space is the command. The branch looking for a run of three spaces is left over from a format that also carried TIME, and it was wrong in two ways at once. It sliced timeAndCommandString by firstSpace - the PID's digit count, which is not an index into that string at all - and then applied the index it found to the unsliced span. So a command containing three consecutive spaces was truncated to whatever followed them, and a seven digit PID with a short command indexed past the end and threw ArgumentOutOfRangeException. That throw comes out of ProcessCleanup's static constructor, so it is not one bad line skipped: it is every launch and every kill in the process, permanently. Two tests, both failing before this: a command with a run of spaces in it, and a long PID with a short command.
This was referenced Aug 26, 2026
This was referenced Aug 27, 2026
Closed
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.
ps -o pid,commandhas exactly one separator, so everything after the firstspace is the command. The branch looking for a run of three spaces is left over
from a format that also carried TIME, and it was wrong in two ways at once.
It sliced timeAndCommandString by firstSpace - the PID's digit count, which is
not an index into that string at all - and then applied the index it found to
the unsliced span. So a command containing three consecutive spaces was
truncated to whatever followed them, and a seven digit PID with a short command
indexed past the end and threw ArgumentOutOfRangeException.
That throw comes out of ProcessCleanup's static constructor, so it is not one
bad line skipped: it is every launch and every kill in the process, permanently.
Two tests, both failing before this: a command with a run of spaces in it, and a
long PID with a short command.