Skip to content

Commit 51dbad2

Browse files
committed
fix(cli): avoid double close
see: #136
1 parent c8a0e3a commit 51dbad2

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

src/cli.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -139,23 +139,6 @@ async function serve() {
139139
await globalThis.__srvx_listen_cb__?.();
140140

141141
printInfo(entry);
142-
143-
// Keep the process alive with proper cleanup
144-
let cleanupCalled = false;
145-
const cleanup = (exitCode?: number) => {
146-
if (cleanupCalled) return;
147-
cleanupCalled = true;
148-
console.log(c.gray("\rGracefully stopping server..."));
149-
server
150-
.close(true)
151-
.catch(console.error)
152-
.then(() => {
153-
console.log(c.gray("Server stopped."));
154-
process.exit(exitCode || 0);
155-
});
156-
};
157-
process.on("SIGINT" /* ctrl + c */, () => cleanup(130));
158-
process.on("SIGTERM", () => cleanup(143));
159142
} catch (error) {
160143
console.error(error);
161144
process.exit(1);

0 commit comments

Comments
 (0)