summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-29 14:27:42 -0300
committerGabriel Schneider <[email protected]>2026-10-29 14:27:42 -0300
commit45b4c9bb28596bb6102c387a4b0e4fbb87c78155 (patch)
treee425adf2b6a048f7fa096487ab4e1340da92bf92
parent7bd678868901ec9ae7c8e4369c16c53d30282e41 (diff)
downloadpardes-45b4c9bb28596bb6102c387a4b0e4fbb87c78155.tar.gz
pardes-45b4c9bb28596bb6102c387a4b0e4fbb87c78155.zip
tty: a kept session whose terminal goes before its first frame detaches, not ends: the reader that takes the daemon's ok starts before kept() waits on it
The reader starts after the first frame, and a hangup handled in that frame had kept() wait its full 2 s for an `ok` nobody read, then end the session. test/daemon.py's killed stub hit it 2 times in 55 under load, and none in 95 after. Co-Authored-By: Claude Opus 5.5 <[email protected]>
-rw-r--r--src/tty/tty.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tty/tty.zig b/src/tty/tty.zig
index 31f62d34..d474e83a 100644
--- a/src/tty/tty.zig
+++ b/src/tty/tty.zig
@@ -1860,7 +1860,10 @@ const Shell = struct {
},
.quit => {
// The terminal went: a session the daemon keeps carries on
- // without it, to be attached again.
+ // without it, to be attached again. Gone before the first
+ // frame, the reader that takes the daemon's `ok` (kept
+ // waits on it) is not started yet: started here.
+ daemon.watch(s.loop, deliverNote);
if (daemon.kept()) {
if (s.attached()) s.leaveTerminal();
return true;