feat(pty): expose child pid on ChildHandle for process-group reaping#529
Closed
fengmk2 wants to merge 1 commit into
Closed
feat(pty): expose child pid on ChildHandle for process-group reaping#529fengmk2 wants to merge 1 commit into
fengmk2 wants to merge 1 commit into
Conversation
The process spawned into a PTY is a session / process-group leader (portable-pty setsid's it), but ChildHandle only exposed a single-process killer. Expose the pid so callers can signal the whole group (`kill(-pid, ...)` on Unix) to reap grandchildren that inherited the slave fd and would otherwise keep the PTY master from ever reaching EOF, hanging `read_to_end`.
Member
Author
|
Not needed after all: instead of reaping the process group to work around the wedge, vite-plus moves its Linux PTY snapshot leg off the Namespace runner to GitHub-hosted |
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.

Expose the child PID on
ChildHandleso callers can signal the child's whole process group.Why
The process spawned into a PTY is a session / process-group leader (portable-pty
setsids it), butChildHandleonly exposed a single-process killer. A caller that needs to reap grandchildren the command left behind, e.g. a managed-runtime or package-manager helper that inherited the PTY slave fd and keeps the master from ever reaching EOF, had no way to target the group.What
Add
ChildHandle::pid() -> Option<u32>, captured at spawn. Additive; no behavior change for existing callers.Consumer
vite-plus's PTY snapshot suite: once a step's command exits, it
killpgs the group so a lingering grandchild can't wedge the exit-wait (read_to_end, which only returns at PTY EOF) on the Namespace Linux runner (macOS reaps fast enough to hit EOF).