summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 09:05:05 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit7b727114350030fa34281803cc12a1dbb7e6f7fc (patch)
tree032114e21cad83d2f5bf2a01e0e69470a568237b /src/pardes.zig
parent78d6f64e72be2a22c40feaf012636bc8f04d46de (diff)
downloadpardes-7b727114350030fa34281803cc12a1dbb7e6f7fc.tar.gz
pardes-7b727114350030fa34281803cc12a1dbb7e6f7fc.zip
A command from a missing directory fails ENOENT with no pane; one whose shell never started ends exit 127
Exec made a command pane in a directory that was not there, whose shell never started: it said running for ever, a follower waited for an exit that never came, and Kill found it. The line now fails up front, as Tty does, `exec: <dir>: no such directory`; and a command pane whose shell the host could not start ends `exit 127` at once. A shell that could not start in its directory says `directory missing`, not `file not found`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 24595045..60a5dfe3 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -5247,7 +5247,17 @@ pub const Pardes = struct {
const pane = p.panes[id] orelse return;
pane.shell_failed = true;
ctlfs.pty.shellGone(p, pane, false);
- p.reportError(id, "shell", err);
+ if (err == error.FileNotFound or err == error.NotDir)
+ p.reportFailure(id, "shell: directory missing (no such directory)")
+ else
+ p.reportError(id, "shell", err);
+ // A command that never started ended: `exit 127`, as a shell says of
+ // a command it could not run, so a follower waiting on its exit
+ // hears one, its tag stops saying it runs, and Kill finds nothing.
+ if (pane.command != null and !pane.command_done) {
+ pane.command_pty = false;
+ exec.commandDone(p, id, 127);
+ }
}
pub fn saveFailed(p: *Pardes, id: u8, path: []const u8, err: anyerror) void {