summaryrefslogtreecommitdiff
path: root/src/host_io.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-14 21:26:47 -0300
committerGabriel Schneider <[email protected]>2026-09-15 17:24:42 -0300
commita624a56e289e4a02a411f83741f0f2c9fc0f0b2e (patch)
treeb87e3ca10dd1c4417112164f792b5da1e26de0a6 /src/host_io.zig
parent95681ff7017b8a9e4c8f9fa6a7371d1233432f2f (diff)
downloadpardes-a624a56e289e4a02a411f83741f0f2c9fc0f0b2e.tar.gz
pardes-a624a56e289e4a02a411f83741f0f2c9fc0f0b2e.zip
Add Linux Tty9p mounted terminals and forward raw TTY keys
Diffstat (limited to 'src/host_io.zig')
-rw-r--r--src/host_io.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/host_io.zig b/src/host_io.zig
index 000d1a88..212c23b4 100644
--- a/src/host_io.zig
+++ b/src/host_io.zig
@@ -867,11 +867,27 @@ pub fn forkShell(
var master: c_int = -1;
var path_buf: [std.fs.max_path_bytes]u8 = undefined;
const spawn = Shell.resolve(bin, &path_buf, prompt_rcs);
+ var helper_buf: [4096]u8 = undefined;
+ const mounted = if (core) |c| if (c.panes[pane]) |pn| pn.v9fs_on_spawn else false else false;
+ const helper: ?[:0]u8 = if (mounted) blk: {
+ if (comptime builtin.os.tag != .linux) return error.LinuxRequired;
+ if (fs == null) return error.SessionSocketRequired;
+ break :blk try @import("linux/v9fs.zig").helperPath(&helper_buf);
+ } else null;
ninep_io.exportPaneEnv(
fs,
if (core) |c| (if (c.panes[pane]) |pn| pn.serial else 0) else 0,
if (core) |c| !c.opts.nested else false,
);
+ if (helper) |path| {
+ const c = core.?;
+ const pn = c.panes[pane].?;
+ const socket = libc.getenv("PARDES_9P") orelse return error.SessionSocketRequired;
+ var command: std.Io.Writer.Allocating = .init(c.gpa);
+ defer command.deinit();
+ try @import("linux/v9fs.zig").writeLaunchCommand(&command.writer, path, std.mem.span(socket), &spawn.argv);
+ if (!try pardes.panes.Terminal.queuePendingCommand(pn, command.written())) return error.ShellAlreadyStarted;
+ }
const ws = posix.winsize{ .row = rows, .col = cols, .xpixel = 0, .ypixel = 0 };
const pid = forkpty(&master, null, null, &ws);
if (pid < 0) return error.ForkFailed;