summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-18 10:19:31 -0300
committerGabriel Schneider <[email protected]>2026-11-18 10:19:31 -0300
commita2538c49b1bb69dcd1a6f1350834e13f68c3c05d (patch)
tree92c0cfb229d44974bf34ce6d4caa379142fbae44 /src/main.zig
parentb2f709d7130571658220636f33b5f89414a5101a (diff)
parent5c5e0102f92938f433a3465c92818be810c1ef78 (diff)
downloadpardes-a2538c49b1bb69dcd1a6f1350834e13f68c3c05d.tar.gz
pardes-a2538c49b1bb69dcd1a6f1350834e13f68c3c05d.zip
integration: addons in a client part 3 (the core's prerequisites and the double free; the PDF kind where it is shown: a plain record and pages as draws) with the client path's round 1: no conflict; tui core-test 820/959 (139 skipped), shell-test 994/997, behaviour-test 274/274, replicas pass, pane-test 180/181; gui unit-test 1588/1592 (its perf check refuses the baseline by compiler version, as on the base), the tui build has no SDL symbol, the frame corpus 74/77 against mbase in Debug and ReleaseFast: frames 58 to 60 show WindowOpacity's notice alone where the base stacked it under InactiveDim's (a PDF render's answer no longer lands between the two ctl writes: accepted, and the baseline recorded anew as mbase2 with those three frames), the perf window -0.405% (threshold 0.5%)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig
index 864e2485..08edc0c1 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -1501,6 +1501,23 @@ fn nativeMain(std_init: std.process.Init) !void {
};
if (attach) |name| if (!resuming) attachTo(init, opts, name);
if (detach) |name| {
+ // A window's binary would start SDL, a GPU device and its fonts for
+ // a window nobody sees (638M instructions, its socket at 255 ms,
+ // 1.2% of a CPU idle): the terminal's binary beside it is the
+ // detached session, as `pardes --detach` (`ps` says tty), its
+ // windows clients. Without one there, it carries on as a window's.
+ if (comptime pardes.platform == .gui) if (!resuming) {
+ var exe: [4096]u8 = undefined;
+ const n = std.c.readlink("/proc/self/exe", &exe, exe.len);
+ if (n > 0) if (std.Io.Dir.path.dirname(exe[0..@intCast(n)])) |bin| if (args.len < 64) {
+ var path_buf: [4104]u8 = undefined;
+ const path = std.fmt.bufPrintSentinel(&path_buf, "{s}/pardes", .{bin}, 0) catch unreachable; // 4096 + 8 fits
+ var argv: [64:null]?[*:0]const u8 = @splat(null);
+ argv[0] = path.ptr;
+ for (args[1..], 1..) |a, k| argv[k] = a.ptr;
+ _ = execvp(path.ptr, &argv);
+ };
+ };
// Said plainly, never a Zig error trace: a name a live session's
// socket holds already (a plain session is named by its pid too).
if (name.len != 0 and !resuming and ninep_io.taken(name)) die(init.io, "a session named {s} is already running", .{name});