summaryrefslogtreecommitdiff
path: root/runtime/main.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-21 09:10:24 -0300
committerGabriel Schneider <[email protected]>2026-11-21 09:10:24 -0300
commitc4f7bb9477c7aa4c8864f14edb9e85b6c8c08437 (patch)
tree9b60bce9e53f96855b40f2ba53e23945a7798ddf /runtime/main.zig
parentf7de6f49ee3d9ac241575f5244743193c9943841 (diff)
parent5ad6067936f306271b875aaf182d4866055da10d (diff)
downloadpardes-c4f7bb9477c7aa4c8864f14edb9e85b6c8c08437.tar.gz
pardes-c4f7bb9477c7aa4c8864f14edb9e85b6c8c08437.zip
integration: the pair's round 5 and the layers' round 2 on the gathered line: pardes-pair-5 (`ssrtxkzx`, on pardes-merge48: a link an Upgrade cuts with no last word asks the daemon whether its session is listed still and joins again (`replica.cutListed`): an upgrade from the installed build carries its clients; a no-daemon pair refuses Restore in words (P42); /dev/tty opened before the pair forks; a TERMed or hung-up client dies of the signal; the process suite as pairs 13 to 8 of 145) and pardes-layers-2 (`myxnnquu`, on pardes-merge49: the click on path@rev tested, a revision read-only from 9P, Syntax off in a patch keeps the patch's colours); no conflict; core-test 893/1053 (160 skipped), shell-test 1095/1098; its gate: .scratch/sketch/reorg/merge50, the numbers in PARDES.md (2026-11-21)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'runtime/main.zig')
-rw-r--r--runtime/main.zig17
1 files changed, 15 insertions, 2 deletions
diff --git a/runtime/main.zig b/runtime/main.zig
index b0338831..aa35e687 100644
--- a/runtime/main.zig
+++ b/runtime/main.zig
@@ -1632,8 +1632,7 @@ fn nativeMain(std_init: std.process.Init) !void {
// No controlling terminal (a detached pty, a daemon): said, not
// an error trace.
error.NoDevice => {
- std.Io.File.stderr().writeStreamingAll(init.io, "pardes: no terminal to draw on: /dev/tty will not open; run it in a terminal, or --detach\n") catch {};
- std.process.exit(1);
+ noTerminal(init.io);
},
else => return err,
},
@@ -1761,6 +1760,13 @@ fn pardesBeside(buf: *[4104]u8) ?[:0]const u8 {
/// the client exits. No fork to be had: returns, and this process is the
/// session, with no terminal: said by the caller's run. A window with no
/// `pardes` beside it returns at once, its own session as before.
+/// A terminal's launch with no terminal to draw on (a detached pty, a
+/// daemon): said, not an error trace, and exit 1.
+fn noTerminal(io: std.Io) noreturn {
+ std.Io.File.stderr().writeStreamingAll(io, "pardes: no terminal to draw on: /dev/tty will not open; run it in a terminal, or --detach\n") catch {};
+ std.process.exit(1);
+}
+
fn pair(init: std.process.Init, opts: *pardes.Options, args: []const [:0]const u8) void {
var path_buf: [4104]u8 = undefined;
var fd_buf: [32]u8 = undefined;
@@ -1771,6 +1777,13 @@ fn pair(init: std.process.Init, opts: *pardes.Options, args: []const [:0]const u
argv[0] = path.ptr;
for (args[1..], 2..) |a, k| argv[k] = a.ptr;
}
+ // Its client draws on /dev/tty: none to be had, said as the own path
+ // says it, before a session is forked for nobody.
+ if (pardes.platform == .tui) {
+ const tty = std.c.open("/dev/tty", .{ .ACCMODE = .RDWR, .CLOEXEC = true }, @as(std.c.mode_t, 0));
+ if (tty < 0) noTerminal(init.io);
+ _ = std.c.close(tty);
+ }
const conn: ?c_int = if (pardes.platform == .tui and daemon.wanted()) daemon.connect(true) else null;
var fds: [2]c_int = undefined;
if (std.c.socketpair(std.c.AF.UNIX, std.c.SOCK.STREAM | std.c.SOCK.CLOEXEC, 0, &fds) != 0)