summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 21:07:33 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commit1e7c41f855861868d89f1dd2c7969f79f739cef0 (patch)
tree3d3a0fa9574a4d657961d42513d90a7461d2490b /src
parent04b047fb366ea2c595708fb62467f690fce4b9ec (diff)
parentbc63a8f38a837d4b0a65d86ccf5f956fc6ff6d83 (diff)
downloadpardes-1e7c41f855861868d89f1dd2c7969f79f739cef0.tar.gz
pardes-1e7c41f855861868d89f1dd2c7969f79f739cef0.zip
Merge: Terminal rename + Kill signal order
Diffstat (limited to 'src')
-rw-r--r--src/host_io.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/host_io.zig b/src/host_io.zig
index e7be28cd..05ccca09 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);
}