summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 03:20:04 -0300
committerGabriel Schneider <[email protected]>2026-11-06 04:13:33 -0300
commit4c2125ecf47588d33f9894c1fdf2833d0512f3b4 (patch)
treec76510fd390e20187554ea86a3fdabd2dfb65ca5 /src/main.zig
parentd1d5d3cfb18841604bba2057eeb3598f729b4475 (diff)
downloadpardes-4c2125ecf47588d33f9894c1fdf2833d0512f3b4.tar.gz
pardes-4c2125ecf47588d33f9894c1fdf2833d0512f3b4.zip
client #2, one frontend a session: the daemon answers `other <name>` for an attach to a session attached already (as it did for one of the other kind), so a second `pardes --attach` or `pardes-gui --attach` on this machine is a replica client through the replica socket, the path a remote one takes; a session tells the daemon its clients (SO_PEERCRED on each replica socket, at every join and leave) and `--ps` lists `client <pid> <command>` under it; the tty's per-terminal Screens (Screen.create/drop/destroy, primary, its stub and Killed slot), the Poster and its `from` input, the Gui's window-fields swap (window_fields, GuiWindow, copyWindow, freshWindow, follow, route, openAnotherWindow, closeView, windowsOpen, closeOtherWindows, resumeWindows), drawOthers and every harness's extra terminals (snapshot.zig's `start ... views=N` and `view <k>`, e2e_harness's initView and drainOthers, PARDES_TEST_VIEWS in both frontends, the GUI feed's `view;<k>`, the monkey's --views) go; the pump draws the one view this process shows (views.shown), through drawOne when a client's input was the last; an Upgrade from a build that kept a second terminal of its own lets it go (its stub told it is detached) and closes its view; deleted: views.snap, views-term.snap and views-pan.snap with their goldens (the in-process second terminal they drove is gone; views.zig's unit tests keep the per-view cursor, layout, register, sizing, closing and panning behaviour, test/replicas.zig and the soak the views of clients); the two views.zig tests that drew through drawOthers draw through drawOne; daemon.py's second terminal is a client listed by --ps, typed into in both terminals, detached from inside and closed; its second window a client listed by --ps and closed; the reference and next-daemon.md say so; no golden changes; gates: core-test 956/956 both, behaviour-test 248/248 both, unit-test 1487/1488 tui and 1530/1531 gui, pane-test 171/172 both, snap all 102 ok, process-test 0 of 37 failed on both, hxdiff 19 and hxparity 6 mismatches (the base's names), hxgolf 0, replicas, addon-test, gui-golden and monkey-gui 0 of 1 failed, daemon.py main, --window-clients and --gui ok, soak local pass (differ, mispred, view_bad, lost 0)
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/main.zig b/src/main.zig
index 6f8a9923..623b6033 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -100,9 +100,9 @@ const help_text =
\\ --attach show the one detached session here (with
\\ none, the one session): in this terminal for
\\ `pardes`, a window for `pardes-gui`. One
- \\ attached already gets another view; one of the
- \\ other kind (a window's session in a terminal,
- \\ or the reverse) is joined as a client, as
+ \\ attached already, or of the other kind (a
+ \\ window's session in a terminal, or the
+ \\ reverse), is joined as a client, as
\\ --attach=<sock>:<name>. Returns when the
\\ session detaches or ends
\\ --attach=<name> ...the session called <name> (its --9p or
@@ -117,8 +117,8 @@ const help_text =
\\ --attach=<sock>:<name> ...through that socket (a path, with a '/'),
\\ one forwarded already, or this machine's
\\ --ps what the pardes daemon keeps: each session (its
- \\ pid, kind, whether attached) and its shells, then
- \\ the shells no session holds
+ \\ pid, kind, whether attached), its clients and its
+ \\ shells, then the shells no session holds
\\ --kill=<name> end session <name> and its shells (TERM, then
\\ KILL 2 s later); unsaved changes are lost
\\ --kill-all end every session and every shell the daemon keeps
@@ -858,6 +858,8 @@ fn manage(io: std.Io, verb: []const u8, name: []const u8) noreturn {
const kind = it.next() orelse "";
const state = it.next() orelse "";
w.print(" session {s} {s} ({s}, {s})\n", .{ std.mem.trim(u8, it.rest(), " "), pid, kind, state }) catch break;
+ } else if (std.mem.eql(u8, what, "client")) {
+ w.print(" client {s} {s}\n", .{ pid, comm }) catch break;
} else if (std.mem.eql(u8, what, "shell")) {
w.print(" shell {s} {s}\n", .{ pid, comm }) catch break;
} else if (std.mem.eql(u8, what, "orphan")) {
@@ -1023,8 +1025,8 @@ fn remoteAttach(init: std.process.Init, opts: pardes.Options, where: []const u8,
/// the daemon) to the detached session of that name, or the only one, and
/// this process its stub until the session leaves it. `pardes-gui
/// --attach`: the session asked to open its window again, and done. A
-/// session of the other kind is joined as a replica client, through this
-/// machine's replica socket.
+/// session attached already, or of the other kind, is joined as a replica
+/// client, through this machine's replica socket.
fn attachTo(init: std.process.Init, opts: pardes.Options, name: []const u8) noreturn {
const io = init.io;
var words: [600]u8 = undefined;
@@ -1057,7 +1059,8 @@ fn attachTo(init: std.process.Init, opts: pardes.Options, name: []const u8) nore
}
}
-/// A session of the other kind (`--attach`'s): a replica client of it here.
+/// A session attached already or of the other kind (`--attach`'s): a
+/// replica client of it here.
fn crossAttach(init: std.process.Init, opts: pardes.Options, name: []const u8) noreturn {
var sock_buf: [ninep_io.sun_path_len:0]u8 = undefined;
const sock = daemon.replicaSocket(&sock_buf) orelse die(init.io, "--attach: no runtime directory for the replica socket", .{});