diff options
Diffstat (limited to 'runtime/session.zig')
| -rw-r--r-- | runtime/session.zig | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/session.zig b/runtime/session.zig index fdd72c2b..5d7eff78 100644 --- a/runtime/session.zig +++ b/runtime/session.zig @@ -103,6 +103,10 @@ pub fn Loop(comptime Frontend: type) type { defer l.peers.deinit(); // Before the core goes: each client sees its link end. defer l.peers.dropAll(l.core); + // A first client on the socket it was started with, before its + // first effects: it has every terminal from its first byte, and + // no reload (Core.openView). + if (o.pair) |fd| l.peers.join(l.core, .{ .fd = fd }); l.effects(); // ...and its shells, once a fresh session's own has a directory // to adopt them in. @@ -113,12 +117,17 @@ pub fn Loop(comptime Frontend: type) type { l.ptys.start(l.core); l.watches.start(); try fe.start(&l); + // A `new --detach`'s launch returns now. + daemon.launched(); while (!l.core.quit) { pardes.turn.bump(&pardes.turn.restores); try l.core.pump(l.host); // Its unit to each replica client, and theirs taken in. l.peers.boundary(l.core); + // A pair's session with no daemon ends with its last link: + // nothing could attach to it again. + if (o.pair != null and daemon.link < 0 and l.peers.count() == 0) break; fe.sent(); upgrade.locate(); // Asked in the step (the word), done between steps: the @@ -132,6 +141,8 @@ pub fn Loop(comptime Frontend: type) type { if (l.core.quit) break; if (l.core.takeRestore()) |rp| l.restore(rp); } + // The clients' last word: the session ended (Exit). + l.peers.ended(0); // Its serve threads read the core: they end first. if (l.fs) |f| { f.deinit(l.gpa); |
