summaryrefslogtreecommitdiff
path: root/src/tty
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-30 21:35:50 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commit4e5719a133030e8ed29799d4959bb0b917092d7c (patch)
treed933325f8bc15e4484385c5b00f64b63794ffa20 /src/tty
parent20685b048fcb307840451471679339c9b9704b23 (diff)
downloadpardes-4e5719a133030e8ed29799d4959bb0b917092d7c.tar.gz
pardes-4e5719a133030e8ed29799d4959bb0b917092d7c.zip
An editor killed with SIGTERM or SIGHUP removes its 9P socket, and a start sweeps the pardes-9p-<pid>.sock files whose pid is gone
The runtime directory had gathered a hundred sockets of dead editors: only a clean exit removed its own, and a signal or a crash left it. The terminal's kill handler and, where nothing else handles the signals, a handler of the listener's own now unlink the socket before the signal's death. At listen, each pardes-9p-<pid>.sock whose pid kill(pid, 0) answers ESRCH for, that is a socket of this user's and that nothing answers on, is removed; a live pid's, a named session's and anything else are never touched. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/tty')
-rw-r--r--src/tty/tty.zig2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/tty/tty.zig b/src/tty/tty.zig
index eabbbe22..8d121b1f 100644
--- a/src/tty/tty.zig
+++ b/src/tty/tty.zig
@@ -1150,6 +1150,8 @@ const Killed = struct {
_ = std.c.write(fd, reset, reset.len);
_ = std.c.tcsetattr(fd, .FLUSH, &cooked);
}
+ // The 9P socket goes too: a killed editor leaves none behind.
+ ninep_io.unlinkOwnSocket();
// SA_RESETHAND put the default back: the same signal, now fatal.
_ = std.c.raise(sig);
}