summaryrefslogtreecommitdiff
path: root/src/tty/tty.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 09:03:41 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit78d6f64e72be2a22c40feaf012636bc8f04d46de (patch)
treeae2f5828eb32f78e1536a75235706828067e6e0b /src/tty/tty.zig
parent039ae6aa70d963f942d8a5747060c67599664af9 (diff)
downloadpardes-78d6f64e72be2a22c40feaf012636bc8f04d46de.tar.gz
pardes-78d6f64e72be2a22c40feaf012636bc8f04d46de.zip
A shell given a directory is not taken to be in this process's before it has spoken, so it logs no rename to the session's and back
Each host read /proc/<pid>/cwd right after forking the shell and at every frame after; before the shell's chdir that says this process's directory, a rename to it, then the real one a frame later, a rename back. A shell given a directory is named by it already (newShell) and is no longer asked at fork; and until it has printed anything, an answer naming this process's directory is not taken. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/tty/tty.zig')
-rw-r--r--src/tty/tty.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tty/tty.zig b/src/tty/tty.zig
index a41e42e2..762616f5 100644
--- a/src/tty/tty.zig
+++ b/src/tty/tty.zig
@@ -1249,7 +1249,10 @@ const Shell = struct {
const command = if (s.core.panes[pane]) |pn| pn.command != null else false;
s.ptys[pane] = .{ .file = child.file, .pid = child.pid, .reader = .{ .any_future = null, .result = {} }, .cmd = .{ .watched = command and host_io.watchExit(child.pid), .fd = child.file.handle } };
var lbuf: [pardes.memory.limits.host_path_cap + 1]u8 = undefined;
- if (host_io.shellCwd(child.pid, &lbuf)) |wd| s.core.setCwd(pane, wd);
+ // Only a shell given no directory is asked where it is: one given a
+ // directory is named by it already (newShell), and asked now, before
+ // its chdir, it would answer this process's, a rename to undo.
+ if (cwd.len == 0) if (host_io.shellCwd(child.pid, &lbuf)) |wd| s.core.setCwd(pane, wd);
if (s.threads_ok) {
if (s.ptys[pane]) |*pt| {
pt.reader = s.io.concurrent(readPty, .{ s.io, s.gpa, pt.file, @as(usize, pane), s.gens[pane], s.loop }) catch pt.reader;