This commit is contained in:
Hiroki 2026-01-31 00:41:11 +08:00 committed by GitHub
commit 22a02a9df5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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`);
}