Skip to content

fix(runner): drain terminal responses after child exits#68

Closed
DecampsRenan wants to merge 1 commit into
mainfrom
run-ctrlc-stdin
Closed

fix(runner): drain terminal responses after child exits#68
DecampsRenan wants to merge 1 commit into
mainfrom
run-ctrlc-stdin

Conversation

@DecampsRenan
Copy link
Copy Markdown
Owner

Summary

  • Switch runner.Run from syscall.Exec to a subprocess execution model so spm survives the child's exit
  • Drain pending terminal escape responses (DECRPM, cursor position, …) from stdin after the child exits, fixing random characters appearing at the shell prompt after Ctrl+C on TUI-style commands like turbo
  • Forward SIGINT/SIGTERM to the child and preserve the conventional exit codes (130 / 143)

Test plan

  • go test ./... passes (existing SIGINT/SIGTERM exit-code tests still green)
  • Manual: spm dev in a turbo project, Ctrl+C, confirm shell prompt is clean

🤖 Generated with Claude Code

Run commands as subprocess instead of replacing via syscall.Exec, so
spm can drain pending terminal escape responses (DECRPM, cursor pos…)
left in stdin when TUI-style commands like turbo are killed by Ctrl+C.
Without this drain, those bytes leak into the shell and surface as
random characters at the next prompt.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@DecampsRenan
Copy link
Copy Markdown
Owner Author

Closing — root cause is upstream (turbo not restoring terminal on Ctrl+C); the workaround only covers the spm-in-the-chain case. Reverting.

@DecampsRenan DecampsRenan deleted the run-ctrlc-stdin branch April 28, 2026 12:16
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