summaryrefslogtreecommitdiff
path: root/src/host_io.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/host_io.zig')
-rw-r--r--src/host_io.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/host_io.zig b/src/host_io.zig
index 63b907ac..b167ef8a 100644
--- a/src/host_io.zig
+++ b/src/host_io.zig
@@ -965,6 +965,7 @@ pub fn forkShell(
const native_cwd = filesystem.localPath(cwd) orelse cwd;
if (std.mem.indexOfScalar(u8, native_cwd, 0) != null) return error.InvalidPath;
var cwd_buf: [4096]u8 = undefined;
+ const serial = if (core) |c| if (c.panes[pane]) |pn| pn.serial else 0 else 0;
const cwd_z: ?[:0]const u8 = if (native_cwd.len == 0) null else dir: {
const path = std.fmt.bufPrintSentinel(&cwd_buf, "{s}", .{native_cwd}, 0) catch return error.NameTooLong;
// A shell's directory may be inside a mount this editor serves.
@@ -974,6 +975,9 @@ pub fn forkShell(
if (stat.kind != .directory) return error.NotDir;
break :dir path;
};
+ // The turn was given up for the stat: a 9P client may have closed the
+ // pane, and another taken its slot, whose command this is not.
+ if (core) |c| if ((if (c.panes[pane]) |pn| pn.serial else 0) != serial) return error.PaneGone;
var master: c_int = -1;
var path_buf: [std.fs.max_path_bytes]u8 = undefined;
// A terminal opened on a shell of its own (`Tty fish`) runs that one.