moonlait 0.2.0 → 0.2.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/dist/cli.js +23 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -24310,17 +24310,38 @@ WantedBy=default.target
|
|
|
24310
24310
|
function run(command, args) {
|
|
24311
24311
|
execFileSync2(command, [...args], { stdio: "ignore" });
|
|
24312
24312
|
}
|
|
24313
|
+
function waitUntilUnloaded(target, tries = 20) {
|
|
24314
|
+
for (let attempt = 0; attempt < tries; attempt += 1) {
|
|
24315
|
+
try {
|
|
24316
|
+
execFileSync2("launchctl", ["print", target], { stdio: "ignore" });
|
|
24317
|
+
} catch {
|
|
24318
|
+
return;
|
|
24319
|
+
}
|
|
24320
|
+
execFileSync2("sleep", ["0.25"], { stdio: "ignore" });
|
|
24321
|
+
}
|
|
24322
|
+
}
|
|
24313
24323
|
function install(paths) {
|
|
24314
24324
|
if (process.platform === "darwin") {
|
|
24315
24325
|
const file2 = plistPath();
|
|
24316
24326
|
mkdirSync2(path5.dirname(file2), { recursive: true });
|
|
24317
24327
|
mkdirSync2(bridgeHome(), { recursive: true });
|
|
24318
24328
|
writeFileSync2(file2, plist(paths));
|
|
24329
|
+
const domain2 = `gui/${process.getuid?.() ?? 501}`;
|
|
24319
24330
|
try {
|
|
24320
|
-
run("launchctl", ["bootout",
|
|
24331
|
+
run("launchctl", ["bootout", `${domain2}/${LABEL}`]);
|
|
24321
24332
|
} catch {
|
|
24322
24333
|
}
|
|
24323
|
-
|
|
24334
|
+
waitUntilUnloaded(`${domain2}/${LABEL}`);
|
|
24335
|
+
try {
|
|
24336
|
+
run("launchctl", ["bootstrap", domain2, file2]);
|
|
24337
|
+
} catch {
|
|
24338
|
+
waitUntilUnloaded(`${domain2}/${LABEL}`);
|
|
24339
|
+
try {
|
|
24340
|
+
run("launchctl", ["bootstrap", domain2, file2]);
|
|
24341
|
+
} catch {
|
|
24342
|
+
run("launchctl", ["kickstart", "-k", `${domain2}/${LABEL}`]);
|
|
24343
|
+
}
|
|
24344
|
+
}
|
|
24324
24345
|
return file2;
|
|
24325
24346
|
}
|
|
24326
24347
|
if (process.platform === "linux") {
|
package/package.json
CHANGED