diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 22:58:12 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 22:58:12 -0300 |
| commit | 3ddd34bcd94ba95d9cacbf6afcb9f89a16a414ce (patch) | |
| tree | e4fee3fc0c7e228f4ac0a5877eb44b997f7bdb11 /src/host_io.zig | |
| parent | 1b654dfeb5b832d110beef0ec7dd8a3b7f66e431 (diff) | |
| download | pardes-3ddd34bcd94ba95d9cacbf6afcb9f89a16a414ce.tar.gz pardes-3ddd34bcd94ba95d9cacbf6afcb9f89a16a414ce.zip | |
Edit's w to a file changed on disk since read is refused once, as Save is (w again to overwrite), the rest of an X/'/w written and the refused named; Edit filters get a pane command's environment ($PARDES_MOUNT, $PARDES_9P, $PARDES_PID, $winid); an Edit with no commands runs beside one whose commands run unless it touches a file that one changes, refused busy (EBUSY) as is a second Edit with commands
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/host_io.zig')
| -rw-r--r-- | src/host_io.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/host_io.zig b/src/host_io.zig index ee503061..7314affc 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -1469,6 +1469,20 @@ test "the child environment replaces the launcher's terminal identity exactly on extern "c" fn unsetenv(name: [*:0]const u8) c_int; +/// The environment a pane's command is given (exportPaneEnv, `$winid`, +/// ChildEnv), as `NAME=value` lines in `arena`, for a command that is not a +/// pane's: an Edit's filters, run from pane `serial`. +pub fn commandEnv(arena: std.mem.Allocator, serial: u32, adopts: bool) ![]const []const u8 { + ninep_io.exportSessionEnv(serial, adopts); + exportWinid(serial); + var slots: ChildEnv.Slots = undefined; + const envp = ChildEnv.build(&slots, .command) orelse return error.EnvironmentTooLarge; + var out: std.ArrayList([]const u8) = .empty; + var i: usize = 0; + while (envp[i]) |entry| : (i += 1) try out.append(arena, try arena.dupe(u8, std.mem.span(entry))); + return out.items; +} + fn exportWinid(serial: u32) void { var buf: [16]u8 = undefined; if (serial != 0) if (std.fmt.bufPrintSentinel(&buf, "{d}", .{serial}, 0)) |text| { |
