From fe0aa07c18a9fd5ca6bdcb78e9354a2745e32298 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sat, 21 Nov 2026 03:29:45 -0300 Subject: client: what the pair's last rounds left, each a test first: a window client exec'd at its session's Upgrade comes back the size it was, not the default (runtime/client.zig `execAgain` passed `--attach=` alone, so the new process made a 1120x720 window: a `--geometry=900x560` pair's session went from 56x16 to 70x20 after an Upgrade to another build, with the variable or without (any `pardes-gui attach`); now the window's size at the exec, SDL_GetWindowSize, as `--geometry=WxH`); a pair's client exec'd at an Upgrade waits for its session at `ended` as before the exec (tui.zig and gui.zig `runClient` asked `opts.pair`, which the exec'd `--attach=` client has not: now every near client waits, a non-child answers ECHILD at once; not seen to fail here: the subreaper took the session first); tests in test/daemon.py: `pair_upgrade_views` (plain, --pair: two clients' own views, the pair's scroll and the attach's focus, the same after a same-build Upgrade: the screens by pyte, the focus by where typing lands: passed before this change too), `pair_exec_reaps`, `far_exec` (a far client, PARDES_REPLICA_FAR by the socket's path, execs the build at its start path and agrees after: passed before too), `pair_window_geometry` (offscreen, not test mode: failed before), the last three in --upgrade OLD NEW Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- dev/gui/gui.zig | 14 ++++++++++---- dev/tui/tui.zig | 10 ++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'dev') diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig index d10173b4..d779cf47 100644 --- a/dev/gui/gui.zig +++ b/dev/gui/gui.zig @@ -1429,16 +1429,22 @@ fn clientSession(init: std.process.Init, g: *Gui, opts_in: pardes.Options, test_ .gone => Said.no(io, "'{s}' let this client go (a Detach in it, or the session's end)", .{to.session}), .failed => Said.no(io, "{s}", .{start.said()}), // A new process's window: the build at its start path, exec'd. - .upgrade => |view| Said.no(io, "{s}", .{client_loop.execAgain(&start, view)}), + .upgrade => |view| { + // Its new window the size this one has now. + var size: [2]c_int = .{ 0, 0 }; + _ = c.SDL_GetWindowSize(g.window, &size[0], &size[1]); + Said.no(io, "{s}", .{client_loop.execAgain(&start, view, size)}); + }, .left => { var said: [600]u8 = undefined; std.Io.File.stderr().writeStreamingAll(io, std.fmt.bufPrint(&said, "pardes-gui: detached from '{s}', which is still running; come back with `pardes-gui attach {s}`\n", .{ to.session, to.session }) catch "pardes-gui: detached\n") catch {}; std.process.exit(0); }, .ended => |code| { - // A pair's window is its session's parent: its status once it - // is gone, as the terminal's (tui.zig `runClient`). - if (opts_in.pair != null) { + // A pair's window is its session's parent, an exec'd one too: + // its status once it is gone, as the terminal's (tui.zig + // `runClient`). + if (!to.far) { var status: c_int = 0; while (libc.waitpid(@intCast(start.joined.pid), &status, 0) < 0 and libc.errno(-1) == .INTR) {} } diff --git a/dev/tui/tui.zig b/dev/tui/tui.zig index a6d2216d..09704424 100644 --- a/dev/tui/tui.zig +++ b/dev/tui/tui.zig @@ -800,9 +800,11 @@ pub fn runClient(init: std.process.Init, opts: pardes.Options, path: []const u8, }, .ended => |code| { screen.leave(); - // A pair's client is its session's parent: its status once it - // is gone, as a terminal's job ends with its program. - if (opts.pair != null) { + // A pair's client is its session's parent, an exec'd one too + // (an Upgrade's, which `opts.pair` no longer says): its status + // once it is gone, as a terminal's job ends with its program. + // Not its child: no wait (ECHILD at once). + if (!far_link) { var status: c_int = 0; while (libc.waitpid(@intCast(start.joined.pid), &status, 0) < 0 and libc.errno(-1) == .INTR) {} } @@ -816,7 +818,7 @@ pub fn runClient(init: std.process.Init, opts: pardes.Options, path: []const u8, // The blink: its screen left, the build at its start path // exec'd, which enters it again. screen.leave(); - Said.no(io, "{s}", .{client_loop.execAgain(&start, view)}); + Said.no(io, "{s}", .{client_loop.execAgain(&start, view, null)}); }, } } -- cgit v1.3