demobite 1.19.0 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/launcher/index.mjs +9 -1
- package/package.json +1 -1
package/launcher/index.mjs
CHANGED
|
@@ -323,7 +323,15 @@ if (arg === "on") {
|
|
|
323
323
|
spawnSync("launchctl", ["bootout", `gui/${process.getuid()}/${SERVICE_LABEL}`], { stdio: "ignore" });
|
|
324
324
|
killListener();
|
|
325
325
|
fs.writeFileSync(def.file, plist);
|
|
326
|
-
|
|
326
|
+
// launchd can refuse a bootstrap in the second after a bootout of the same label (I/O error while the
|
|
327
|
+
// old job is torn down; seen 2026-10-16 right after an update): a few tries, a second apart.
|
|
328
|
+
let r = null;
|
|
329
|
+
for (let i = 0; i < 5; i++) {
|
|
330
|
+
r = spawnSync("launchctl", ["bootstrap", `gui/${process.getuid()}`, def.file], { encoding: "utf8" });
|
|
331
|
+
if (r.status === 0) break;
|
|
332
|
+
spawnSync("launchctl", ["bootout", `gui/${process.getuid()}/${SERVICE_LABEL}`], { stdio: "ignore" });
|
|
333
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 1000);
|
|
334
|
+
}
|
|
327
335
|
if (r.status !== 0) { warn(`launchctl refused the service: ${(r.stderr || r.stdout || "").trim()}`); process.exit(1); }
|
|
328
336
|
} else if (process.platform === "linux") {
|
|
329
337
|
const unit = `[Unit]\nDescription=DemoBites listener\nAfter=network-online.target\n\n[Service]\nExecStart=${args.map((a) => JSON.stringify(a)).join(" ")}\nWorkingDirectory=${cwd}\nEnvironment=PATH=${pathEnv}\n${process.env.DEMOBITE_HOME ? `Environment=DEMOBITE_HOME=${HOME}\n` : ""}Restart=always\nRestartSec=10\nStandardOutput=append:${LOG}\nStandardError=append:${LOG}\n\n[Install]\nWantedBy=default.target\n`;
|
package/package.json
CHANGED