| @@ -205,7 +205,11 @@ export const installSupervisedService = async (opts: InstallOptions): Promise<vo · 204 unmodified lines |
| 205 | writeFileSync(plistPath(), plist, { mode: 0o600 }); | 205 | writeFileSync(plistPath(), plist, { mode: 0o600 }); |
| 206 | | 206 | |
| 207 | // Re-bootstrap cleanly so a stale registration doesn't make bootstrap fail. | 207 | // Re-bootstrap cleanly so a stale registration doesn't make bootstrap fail. |
| | 208 | // `uninstallSupervisedService` also records the label as disabled in |
| | 209 | // launchd's override database; clear that before bootstrapping or reinstall |
| | 210 | // can fail with launchctl's generic "Bootstrap failed: 5" error. |
| 208 | await runCommand("launchctl", ["bootout", serviceTarget(uid)]); | 211 | await runCommand("launchctl", ["bootout", serviceTarget(uid)]); |
| | 212 | await runCommand("launchctl", ["enable", serviceTarget(uid)]); |
| 209 | const bootstrap = await runCommand("launchctl", ["bootstrap", `gui/${uid}`, plistPath()]); | 213 | const bootstrap = await runCommand("launchctl", ["bootstrap", `gui/${uid}`, plistPath()]); |
| 210 | if (bootstrap.code !== 0) { | 214 | if (bootstrap.code !== 0) { |
| 211 | // oxlint-disable-next-line executor/no-error-constructor, executor/no-try-catch-or-throw -- boundary: surfaces to the boot flow | 215 | // oxlint-disable-next-line executor/no-error-constructor, executor/no-try-catch-or-throw -- boundary: surfaces to the boot flow |
| @@ -213,7 +217,6 @@ export const installSupervisedService = async (opts: InstallOptions): Promise<vo · 1 unmodified line |
| 213 | `launchctl bootstrap failed (exit ${bootstrap.code}): ${bootstrap.stderr.trim() || bootstrap.stdout.trim()}`, | 217 | `launchctl bootstrap failed (exit ${bootstrap.code}): ${bootstrap.stderr.trim() || bootstrap.stdout.trim()}`, |
| 214 | ); | 218 | ); |
| 215 | } | 219 | } |
| 216 | await runCommand("launchctl", ["enable", serviceTarget(uid)]); | | |
| 217 | serviceLog.info(`installed supervised service on port ${opts.port}`); | 220 | serviceLog.info(`installed supervised service on port ${opts.port}`); |
| 218 | }; | 221 | }; |
| 219 | | 222 | |