From 5f64c0ad37106adac292a09e6d447223ac314ab9 Mon Sep 17 00:00:00 2001 From: Lukas Kosina Date: Tue, 3 Mar 2026 14:46:14 +0100 Subject: [PATCH] Fix install command to stop and uninstall before installing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The install command now runs stop → uninstall → install to ensure the new version propagates immediately after installation. The uninstall command also stops the server first. Both commands include error handling for unhandled promise rejections. Closes #32 --- src/bin.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/bin.ts b/src/bin.ts index b9001eb..26dad55 100644 --- a/src/bin.ts +++ b/src/bin.ts @@ -199,12 +199,25 @@ function main(): void { const { port, command, noHooks, noOpen } = parseArgs(process.argv); if (command === "install") { - install(port); + (async () => { + await stopServer(); + uninstall(); + install(port); + })().catch((err) => { + console.error("Install failed:", err); + process.exit(1); + }); return; } if (command === "uninstall") { - uninstall(); + (async () => { + await stopServer(); + uninstall(); + })().catch((err) => { + console.error("Uninstall failed:", err); + process.exit(1); + }); return; }