From a624a56e289e4a02a411f83741f0f2c9fc0f0b2e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 14 Sep 2026 21:26:47 -0300 Subject: Add Linux Tty9p mounted terminals and forward raw TTY keys --- src/host_io.zig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/host_io.zig') 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; -- cgit v1.3