fix(daemon): enable launchd service before bootstrap
When a launchd service is uninstalled via bootout, macOS marks it as disabled in /var/db/com.apple.xpc.launchd/disabled.*.plist. This persists across reboots and plist recreation. Future bootstrap calls fail with error 5 (I/O error) because the service is still marked disabled. Fix: Call 'launchctl enable' before 'launchctl bootstrap' to clear the disabled state, matching the fix already applied to the macOS Swift app in GatewayLaunchAgentManager.swift. Related: #306
This commit is contained in:
committed by
Peter Steinberger
parent
536d3d76a3
commit
d51a9ebb0e
@@ -410,6 +410,7 @@ export async function installLaunchAgent({
|
|||||||
|
|
||||||
await execLaunchctl(["bootout", domain, plistPath]);
|
await execLaunchctl(["bootout", domain, plistPath]);
|
||||||
await execLaunchctl(["unload", plistPath]);
|
await execLaunchctl(["unload", plistPath]);
|
||||||
|
await execLaunchctl(["enable", `${domain}/${label}`]);
|
||||||
const boot = await execLaunchctl(["bootstrap", domain, plistPath]);
|
const boot = await execLaunchctl(["bootstrap", domain, plistPath]);
|
||||||
if (boot.code !== 0) {
|
if (boot.code !== 0) {
|
||||||
throw new Error(`launchctl bootstrap failed: ${boot.stderr || boot.stdout}`.trim());
|
throw new Error(`launchctl bootstrap failed: ${boot.stderr || boot.stdout}`.trim());
|
||||||
|
|||||||
Reference in New Issue
Block a user