Skip to content

Commit

Permalink
test: improve shutting down
Browse files Browse the repository at this point in the history
  • Loading branch information
mxdvl committed Mar 12, 2024
1 parent 13b6793 commit 764e76b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"tasks": {
"build": "deno run -A src/build.ts --site_dir src/_site",
"dev": "deno run -A --node-modules-dir src/build.ts --site_dir src/_site --watch --base=mononykus"
"dev": "deno run -A src/build.ts --site_dir src/_site --watch --base=mononykus"
},
"compilerOptions": {
"strict": true,
Expand Down
2 changes: 1 addition & 1 deletion src/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Deno.test({

const html = await response.text();

process.kill();
process.kill("SIGINT");
await process.output();

assert(html.startsWith(
Expand Down
7 changes: 6 additions & 1 deletion src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const build = async (

await rebuild({ base, out_dir, site_dir, minify });

esbuild.stop();
await esbuild.stop();
};

export const watch = async (
Expand Down Expand Up @@ -173,6 +173,11 @@ export const watch = async (

if (import.meta.main) {
if (flags.watch) {
Deno.addSignalListener("SIGINT", async () => {
console.log("\nShutting down gracefully…")
await esbuild.stop();
});

await watch(options);
} else {
await build(options);
Expand Down

0 comments on commit 764e76b

Please sign in to comment.