fix(gateway): use launchctl stop instead of bootout for gateway stop

`gateway stop` was using `launchctl bootout` which completely unloads
the LaunchAgent from launchd. This meant `gateway start` would fail
because the service registration was gone.

Changed to `launchctl stop` which stops the service but keeps it
registered, allowing `gateway start` to work without reinstalling.

Fixes #3780
This commit is contained in:
HirokiKobayashi-R 2026-01-29 16:08:57 +09:00
parent 109ac1c549
commit 22ee3e3f4b

View File

@ -357,9 +357,11 @@ export async function stopLaunchAgent({
}): Promise<void> {
const domain = resolveGuiDomain();
const label = resolveLaunchAgentLabel({ env });
const res = await execLaunchctl(["bootout", `${domain}/${label}`]);
// Use "stop" instead of "bootout" to keep the service registered.
// This allows "gateway start" to work without reinstalling.
const res = await execLaunchctl(["stop", `${domain}/${label}`]);
if (res.code !== 0 && !isLaunchctlNotLoaded(res)) {
throw new Error(`launchctl bootout failed: ${res.stderr || res.stdout}`.trim());
throw new Error(`launchctl stop failed: ${res.stderr || res.stdout}`.trim());
}
stdout.write(`${formatLine("Stopped LaunchAgent", `${domain}/${label}`)}\n`);
}