Skip to content

feat(terminal): delivered Ctrl+C signals to the foreground process group - #169

Merged
FlareCoding merged 2 commits into
masterfrom
pr/terminal-signals
Aug 13, 2026
Merged

feat(terminal): delivered Ctrl+C signals to the foreground process group#169
FlareCoding merged 2 commits into
masterfrom
pr/terminal-signals

Conversation

@FlareCoding

Copy link
Copy Markdown
Owner

Summary

  • Terminal control bytes were ordinary input: no path existed from Ctrl+C to POSIX signals, so a stuck foreground program could only be killed from another shell.
  • The line discipline intercepts INTR/QUIT/SUSP under a termios-tracked ISIG bit (raw/cooked shortcuts pair it, TCSETS sets it independently) and signals the pty's or console's foreground process group via new TIOCSPGRP/TIOCGPGRP ioctls, with the shell giving each job its own group while the child is frozen between create and start.
  • ptytest proves both outcomes end to end: a default-disposition foreground child dies by SIGINT and a child with a handler installed runs it instead.

Made with Cursor

Terminal control bytes were ordinary input, so a stuck foreground
program could only be killed from another shell. The line discipline
now intercepts INTR/QUIT/SUSP under a termios-tracked ISIG bit and
signals the pty's or console's foreground group, which the shell
assigns to each job while it is frozen between create and start.

Co-authored-by: Cursor <cursoragent@cursor.com>
cursor[bot]

This comment was marked as resolved.

terminal::ERR collides with fs::ERR_NOENT, so console pgrp ioctl
failures surfaced as ENOENT while the pty path reported EINVAL. And a
pipeline failing after its first stage left the terminal's foreground
on the dead job's group instead of restoring the shell's.

Co-authored-by: Cursor <cursoragent@cursor.com>
@FlareCoding
FlareCoding merged commit 341e258 into master Aug 13, 2026
15 checks passed
@FlareCoding
FlareCoding deleted the pr/terminal-signals branch August 13, 2026 05:53
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