Compare commits

..

No commits in common. "0589dd03961ba13612e612e669d8ad1bcfa2a8e0" and "c064e3aab1dc58d82308107b98632fef605615aa" have entirely different histories.

3 changed files with 8 additions and 36 deletions

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "folio", "name": "folio",
"version": "0.1.8", "version": "0.1.7",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "folio", "name": "folio",
"version": "0.1.8", "version": "0.1.7",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@tiptap/core": "^2.27.2", "@tiptap/core": "^2.27.2",

View file

@ -1,6 +1,6 @@
{ {
"name": "folio", "name": "folio",
"version": "0.1.10", "version": "0.1.8",
"description": "A simple, local, open-source desktop writing app.", "description": "A simple, local, open-source desktop writing app.",
"productName": "Folio", "productName": "Folio",
"author": "Folio Contributors", "author": "Folio Contributors",

View file

@ -1286,40 +1286,12 @@ handleIpc("folio:performUpdate", async () => {
}), }),
{ mode: 0o700 } { mode: 0o700 }
); );
// IMPORTANT: on systemd desktops (Hyprland/uwsm) the app runs inside a
// systemd scope cgroup, and a plain detached child stays in that cgroup —
// when the app quits, systemd sweeps the scope and kills the swap script
// mid-run (root cause of the "update failed" reports: the handoff died
// before swapping, and the app was relaunched from the old tree).
// systemd-run puts the script in its own transient unit that outlives us;
// verified to survive on this machine. Fall back to a detached spawn for
// non-systemd sessions.
const { spawn } = await import("child_process"); const { spawn } = await import("child_process");
let handedOff = false; const child = spawn("/bin/sh", [script], { detached: true, stdio: "ignore" });
try { child.on("error", (err) => {
const { execFileSync } = await import("child_process"); console.error("[folio] updater spawn failed:", err.message);
execFileSync("systemd-run", [ });
"--user", "--quiet", "--collect", child.unref();
`--description=Folio updater handoff`,
"/bin/sh", script,
], { timeout: 10_000, stdio: "ignore" });
handedOff = true;
} catch {
try {
const child = spawn("/bin/sh", [script], { detached: true, stdio: "ignore" });
child.on("error", (err) => {
console.error("[folio] updater spawn failed:", err.message);
});
child.unref();
handedOff = true;
} catch (e) {
void e;
}
}
if (!handedOff) {
try { fs.appendFileSync(updateLog, new Date().toISOString() + " FAIL: could not start swap script\n"); } catch { /* ignore */ }
return { error: "Could not start the installer. Your current version is unchanged." };
}
// Quit so the swap script can replace the app directory. // Quit so the swap script can replace the app directory.
setTimeout(() => app.quit(), 300); setTimeout(() => app.quit(), 300);
return { ok: true, version: rel.version }; return { ok: true, version: rel.version };