Conversation
The wrapper backgrounds claude under `set -m` so the child gets its own process group for the watchdog to reap. But a background process group that calls tcsetattr (the TUI's raw-mode switch) draws SIGTTOU and suspends, so interactive `claude` hung on a blank screen while the wrapper blocked in `wait`, and Ctrl+C then killed the suspended child via the cleanup trap. bash 3.2's non-interactive `fg` cannot transfer tty ownership (no tcsetpgrp), so foregrounding after the fact just re-suspends in a loop; supervision and a foreground TUI are mutually exclusive in pure bash. With a tty, exec the real binary and get out of the way. The watchdog path still covers non-tty runs (scripts, pipes, agent spawns), which is where orphan reaping actually matters. Verified under a pty harness: a stub TUI doing the same tcsetattr now runs to completion with its exit code propagated; the non-tty watchdog path and real-binary passthrough are unchanged. Co-Authored-By: Claude Fable 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.
Problem
Interactive
claudehung on a blank screen the moment the wrapper went live. The wrapper backgrounds claude underset -mso the child gets its own process group for the watchdog to reap, but a background process group that callstcsetattr(the TUI's raw-mode switch) draws SIGTTOU and suspends unconditionally. The wrapper then blocked inwaitforever, and Ctrl+C killed the suspended child via the cleanup trap.Why not
fgbash 3.2's non-interactive
fgcannot transfer tty ownership (notcsetpgrpaccess), so foregrounding the job after launch just re-suspends it in a SIGTTOU loop. Reproduced under a pty harness. Supervision and a foreground TUI are mutually exclusive in pure bash 3.2.Fix
When stdin is a tty,
execthe resolved binary before any job-control machinery. Interactive runs become byte-identical to bareclaude(signal flow, exit codes). The watchdog path still covers non-tty runs (scripts, pipes, agent spawns), which is where orphan reaping actually pays rent.Verification
tcsetattr: previously suspended forever, now runs to completion with exit code propagated through the wrapper--versionreturns 2.1.220, exit 0🤖 Generated with Claude Code