fix(pty): resume child on any WUNTRACED stop signal to prevent hang#53
Merged
Conversation
WUNTRACED makes waitpid visible to stops from any signal (SIGTTOU, SIGTTIN, SIGSTOP, etc.), not just the explicitly handled SIGTSTP. The generic fallback arm was logging and continuing without sending SIGCONT, leaving the child stopped indefinitely and the supervisor spinning. For interactive TUI processes (e.g. Claude Code) the startup-timeout safety net is disabled, so the hang is unbounded. Send SIGCONT in the fallback arm across all three supervisor loops so any unexpectedly stopped child is immediately resumed.
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.
Problem
`WUNTRACED` makes `waitpid` visible to stops from any signal — not just the explicitly handled `SIGTSTP`. The generic fallback arm in all three supervisor loops was logging and continuing without sending `SIGCONT`, leaving the child stopped forever.
For interactive TUI processes the startup-timeout safety net is explicitly disabled, so the hang is unbounded. Symptom: the process prints its banner line and then hangs with no further output; `--no-sandbox` works fine.
Fix
Send `SIGCONT` in the generic `WaitStatus::Stopped` fallback arm across all three supervisor loops so any unexpectedly stopped child is immediately resumed.
Testing