fix: stop gateway before uninstall

This commit is contained in:
Peter Steinberger
2026-01-23 07:17:27 +00:00
parent f1afc722da
commit 58f638463f
2 changed files with 19 additions and 1 deletions

View File

@@ -38,6 +38,19 @@ export async function runDaemonUninstall(opts: DaemonLifecycleOptions = {}) {
}
const service = resolveGatewayService();
let loaded = false;
try {
loaded = await service.isLoaded({ env: process.env });
} catch {
loaded = false;
}
if (loaded) {
try {
await service.stop({ env: process.env, stdout });
} catch {
// Best-effort stop; final loaded check gates success.
}
}
try {
await service.uninstall({ env: process.env, stdout });
} catch (err) {
@@ -45,12 +58,16 @@ export async function runDaemonUninstall(opts: DaemonLifecycleOptions = {}) {
return;
}
let loaded = false;
loaded = false;
try {
loaded = await service.isLoaded({ env: process.env });
} catch {
loaded = false;
}
if (loaded) {
fail("Gateway service still loaded after uninstall.");
return;
}
emit({
ok: true,
result: "uninstalled",