diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/host_io.zig | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/host_io.zig b/src/host_io.zig index 9e3fbf79..eb6d1d5d 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -1917,6 +1917,9 @@ fn reapShell(pid: libc.pid_t, grace_ms: u32) void { /// the rest of the line would run on after the job it was on. A stop (TERM /// or KILL) of a command reaches its `&` jobs too, each in a group of its /// own in the shell's session: Kill leaves nothing the line started. +/// The shell goes first: a job that died before it would let it run the +/// line's next command in the gap, and the gap is a scan of all of /proc +/// (signalSession), long once pids have wrapped below the old processes'. pub fn signalTty(shell_pid: libc.pid_t, master_fd: c_int, which: pardes.PtySignal, command: bool) void { const sig = switch (which) { .int => libc.SIG.INT, @@ -1926,9 +1929,9 @@ pub fn signalTty(shell_pid: libc.pid_t, master_fd: c_int, which: pardes.PtySigna .kill => libc.SIG.KILL, }; const fg = tcgetpgrp(master_fd); + if (command and shell_pid > 0 and fg != shell_pid) _ = libc.kill(-shell_pid, sig); if (command and shell_pid > 0 and (which == .term or which == .kill)) signalSession(shell_pid, sig); if (fg > 0) _ = libc.kill(-fg, sig); - if (command and shell_pid > 0 and fg != shell_pid) _ = libc.kill(-shell_pid, sig); if (fg <= 0 and !command and shell_pid > 0) _ = libc.kill(shell_pid, sig); } |
