Skip to content

Commit

Permalink
chore(console): dev command now handles terminal signals (#6889)
Browse files Browse the repository at this point in the history
This changeset improves the `dev` script of the console so it closes the console server before shutting everything down.

Related to #5798.
  • Loading branch information
skyrpex authored Jul 11, 2024
1 parent 33fc028 commit 0b03bf6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions apps/wing-console/console/app/scripts/dev.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ const options = parseArgs({
},
});

let closing = false;
const events = ["beforeExit", "SIGINT", "SIGTERM", "SIGHUP"];
for (const event of events) {
process.on(event, async () => {
if (closing) {
return;
}
closing = true;
await consoleServer.close();
process.exit();
});
}

const vite = await createViteServer({
...viteConfig,
server: {
Expand Down

0 comments on commit 0b03bf6

Please sign in to comment.