summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 10:38:06 -0300
committerGabriel Schneider <[email protected]>2026-10-01 10:46:01 -0300
commit25844b54fd08dd9cadff2275f2161ee5dd316395 (patch)
treeadc48e423cae2f4112051e3d40f16e362aa013ca /src
parent860796aa8832bb9bf32b2770bc0584b962bb51b7 (diff)
downloadpardes-25844b54fd08dd9cadff2275f2161ee5dd316395.tar.gz
pardes-25844b54fd08dd9cadff2275f2161ee5dd316395.zip
`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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/main.zig12
1 files changed, 11 insertions, 1 deletions
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;