From 4e5719a133030e8ed29799d4959bb0b917092d7c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 30 Sep 2026 21:35:50 -0300 Subject: An editor killed with SIGTERM or SIGHUP removes its 9P socket, and a start sweeps the pardes-9p-.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-.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 --- src/tty/tty.zig | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/tty') 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); } -- cgit v1.3