From 370913ae34c69b7958911c6146612c77275f6ebf Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 29 Oct 2026 22:56:07 -0300 Subject: upgrade: a newer build at the path a session started from is said at a focus-in, once a build, the path read just after the first frame (off a startup's way); an upgraded process lets the binary it replaced go (held, its deleted file kept its blocks) and sweeps its old image's prompt files (kept for an exec that failed); test/daemon.py --upgrade asks through /ctl, checks the fds and prompt files level, and runs on FreeBSD (procstat, the daemon's registry, no kept old binary there) Co-Authored-By: Claude Opus 5.5 --- src/gui/gui.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/gui/gui.zig') diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 24061251..e4d69281 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -2502,6 +2502,7 @@ fn localSession( while (!core.quit) { pardes.turn.bump(&pardes.turn.restores); try core.pump(host); + upgrade.locate(); // Asked in the step (the word), done between steps: the session whole. if (shell.upgrade_asked) |pane| shell.upgradeNow(pane); // A window asked for again, or an adopted shell, from the daemon's @@ -3138,7 +3139,10 @@ fn dispatch(g: *Gui, in: *Input, sev: *const c.SDL_Event) void { in.close(); }, c.SDL_EVENT_WINDOW_CLOSE_REQUESTED => in.close(), - c.SDL_EVENT_WINDOW_FOCUS_GAINED => in.post(.{ .focus = true }), + c.SDL_EVENT_WINDOW_FOCUS_GAINED => { + in.post(.{ .focus = true }); + if (in.core) |core| upgrade.noticeNewer(core); + }, c.SDL_EVENT_WINDOW_FOCUS_LOST => in.post(.{ .focus = false }), c.SDL_EVENT_WINDOW_MOUSE_LEAVE => { g.pointer_present = false; @@ -4060,7 +4064,6 @@ const Shell = struct { if (!upgrade.writeDump(at, bytes)) break :failed std.fmt.bufPrint(&why, "Upgrade: the session's dump could not be written to {s}; it stays as it is", .{at[0..@min(at.len, 600)]}) catch "Upgrade: its dump could not be written"; rec.dump = at; rec.old = upgrade.openSelf(); - host_io.Shell.unlinkOwnedRcs(); daemon.upgraded(); if (s.fs) |f| f.flushOut(); const err_words = upgrade.exec(s.gpa, path, -1, &rec); -- cgit v1.3