Skip to content

fix(sidecar): route shared-terminal child output through the PTY master only#209

Merged
NathanFlurry merged 1 commit into
mainfrom
fix/shared-tty-child-output
Jul 2, 2026
Merged

fix(sidecar): route shared-terminal child output through the PTY master only#209
NathanFlurry merged 1 commit into
mainfrom
fix/shared-tty-child-output

Conversation

@NathanFlurry

Copy link
Copy Markdown
Member
  • A child process sharing the shell's terminal (its kernel fd 1 is the inherited PTY slave) used to surface its output twice: once relayed by the shell runner from the child's stdout events, and once when the same bytes — written into the PTY slave — were drained from the master on the next input write. Every external command's output printed twice, and vim's per-keystroke echo corrupted the screen (stray characters where vim skipped repainting a cell it knew was blank).
  • Children now record the (pid, master fd) owner of the shared terminal at spawn. Their stdio writes go through their own PTY slave (line discipline applies) and the master is drained immediately, surfacing the bytes once as the owning shell process's ordered output stream — no child stdout event is queued, so nothing gets relayed, matching native semantics where a shell never sees its child's tty output.
  • Applies to both the child-event pump (foreground children) and the main sync-RPC handler (detached children), and propagates through nested spawns.

@railway-app railway-app Bot temporarily deployed to secure-exec / secure-exec-pr-209 July 2, 2026 16:34 Destroyed
@NathanFlurry NathanFlurry merged commit 3b79529 into main Jul 2, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant