Repository navigation
Reduce ProcessRunner to the run methods and teardown its callers use - #196
Merged
Merged
Conversation
swift-subprocess ends its teardown sequence when the group leader exits and runs none when the leader exits by itself, so the runner still kills what is left of the process group. It now does that with one waitid and a kill loop. runSimple lets the child write to standard output itself and reports the child's bounded standard error on failure, which replaces the DispatchIO writer. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
…the chunk consumer Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
…open Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
swift-subprocess closes a streamed pipe only when its sequence ends. A failed or cancelled chunk consumer now stops the child and discards the rest. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
…ends A descendant that keeps writing would otherwise hold the run open. Terminal state and the input file are now handled around the spawn itself, after the command has been validated. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
… cancelled Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
lynnswap
commented
Nov 20, 2026
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Summary
Reduces
ProcessRunnerto what its callers use.CommandRunninglosesrunStreaming, the four run methods share one launch and error-mapping path, and process-group teardown shrinks from aproc_listpgrppidsinspection to onewaitidand akillloop.ProcessRunner.swiftgoes from 1,510 to 926 lines;BoundedProcessOutputand its collector are unchanged.Details
CommandRunning:runStreamingis removed, andrunBufferedbecomes a requirement instead of defaulting to it. No other method changes, and nothing underSources/PrivateHeaderKitCLIis touched. The test doubles change only for that:RecordingCommandRunner.runStreamingis renamed torunBuffered(itssetStreamingHandlerandstreamingCommandSnapshotkeep their names), and the two private runners inPrivateHeaderKitCLITests.swiftdrop or rename theirrunStreaming.runSimplelets the child write to the CLI's standard output directly, which replaces theDispatchIOwriter. The child's standard error no longer appears on standard output. It is collected, bounded, and included in the thrown error. The affected commands aresimctl bootstatus,simctl delete,tar, the SSH maintenance scripts, andscripts/build-release.shin a checkout.terminationObservedAtUnixEpochMicrosecondscomes fromDate; the injected clock and its overflow checks are gone.killthat fails withEPERMbecause a live group member runs with other credentials. The old code inspected the group to tell that apart from a group of zombies and threw. Every command the CLI runs executes as the invoking user, and neither they nor the repository's scripts usesudoor a setuid tool.runSimplewhen the CLI's standard output is closed. The old writer failed ondupbefore launching.runInteractiveandrunWithInputFilenow try eachPATHcandidate like the other methods. Their callers pass/usr/bin/scriptandssh.Testing
swift test: all six test bundles pass locally withmainmerged in, and the package's full test scheme passes throughxcodebuildon a second macOS host (** TEST SUCCEEDED **). The runner tests passed in 10 consecutive runs. GitHub CI passed on the head beforemainwas merged in; this PR was merged without waiting for the busy CI queue on the final head.Foundationgeneration on macOS 27.2.1 completes (1,025 files), and one throughsimctl spawnon an iOS 27.2 simulator completes.interruptedand no helper process remains.simctl spawnruns the Simulator helper: the CLI exits within 0.1 s, and neithersimctlnor the helper underlaunchd_simremains.runBufferedcalls, and eight cancelledrunCaptureChunkscalls leave the number of open descriptors unchanged.waitidon a global queue, which holds one thread per running command while the CLI runs its commands one at a time.🤖 Generated with Claude Code