summaryrefslogtreecommitdiff
path: root/src/ninep/pty.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 08:02:47 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit0ec8d0dc6217486446f2fe2156dff136173a4ef5 (patch)
tree8e20f9f0fec47f614492d31c7f03a03e3ac1d0c5 /src/ninep/pty.zig
parentba0a0f82be43dde325012b3018b186bc808bdafc (diff)
downloadpardes-0ec8d0dc6217486446f2fe2156dff136173a4ef5.tar.gz
pardes-0ec8d0dc6217486446f2fe2156dff136173a4ef5.zip
Tty in a missing directory fails and makes no pane; a shell that never started answers runs
The host could not start the shell (its chdir failed), and the pane stayed with no pty: a run written to it waited for a prompt for ever. Tty now refuses a directory that is not there, `Tty: <dir>: no such directory`, before making a pane; and a terminal whose shell the host could not start (Pardes.shellFailed, from each host's spawn) answers any run with `error shell gone`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/pty.zig')
-rw-r--r--src/ninep/pty.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ninep/pty.zig b/src/ninep/pty.zig
index 4009af49..68f98554 100644
--- a/src/ninep/pty.zig
+++ b/src/ninep/pty.zig
@@ -196,7 +196,10 @@ pub fn writeRun(p: *Pardes, req: Req, id: usize, pane: *Pane) Reply {
const pf = &pane.fs;
const state = pane.terminal orelse return tree.failText(req.tag, E.INVAL, e_bad_line);
const marks = &state.stream.handler;
- if (pane.command != null) {
+ if (pane.shell_failed) {
+ // Its shell never started: no prompt is coming to wait for.
+ answer(p, slot, "error shell gone", .{});
+ } else if (pane.command != null) {
// Its child is the command, and no shell is there to take a line.
answer(p, slot, "error {s}", .{if (pane.command_done) "command done; not a shell" else "a command runs here, not a shell"});
} else if (pf.unmarked) {