From 25844b54fd08dd9cadff2275f2161ee5dd316395 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 10:38:06 -0300 Subject: `pardes --wait` whose $PARDES_9P no longer answers says the session is gone, exit 1, instead of drawing a screen of its own in the asker's terminal Co-Authored-By: Claude Opus 5.5 --- src/main.zig | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index 6d895307..f6a3a3ec 100644 --- a/src/main.zig +++ b/src/main.zig @@ -514,7 +514,17 @@ fn nativeMain(init: std.process.Init) !void { // Does it answer? One that answers takes the file or says why not, // as acme's B does: from here on never a nested editor, whose // screen would be drawn inside the pane that asked. - ninep_io.Client.probe(arena, parent.dial) catch break :forwarding; + ninep_io.Client.probe(arena, parent.dial) catch { + // `--wait` is someone's EDITOR waiting on that session: a screen + // of its own drawn in their terminal is no answer. Said, exit 1. + if (wait) { + var buf: [4300]u8 = undefined; + const text = std.fmt.bufPrint(&buf, "pardes: --wait: the session at {s} does not answer; it is gone\n", .{parent.dial[0..@min(parent.dial.len, 4096)]}) catch "pardes: --wait: the session does not answer\n"; + std.Io.File.stderr().writeStreamingAll(init.io, text) catch {}; + std.process.exit(1); + } + break :forwarding; + }; const Refuse = struct { fn with(io: std.Io, what: []const u8, err: anyerror) noreturn { var words_buf: [128]u8 = undefined; -- cgit v1.3