From 28b362adfc49324e20af5ecb1530f89eb91c4ed5 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Mon, 11 Mar 2024 10:22:28 -0700 Subject: fix(runtime): Restore default signal handler after user handlers are unregistered (#22757) Fixes #22724. Fixes #7164. This does add a dependency on `signal-hook`, but it's just a higher level API on top of `signal-hook-registry` (which we and `tokio` already depend on) and doesn't add any transitive deps. --- tests/unit_node/process_test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tests/unit_node/process_test.ts') diff --git a/tests/unit_node/process_test.ts b/tests/unit_node/process_test.ts index a28e1e5cd..f496290d9 100644 --- a/tests/unit_node/process_test.ts +++ b/tests/unit_node/process_test.ts @@ -237,7 +237,7 @@ Deno.test({ Deno.test({ name: "process.off signal", - ignore: true, // This test fails to terminate + ignore: Deno.build.os == "windows", async fn() { const testTimeout = setTimeout(() => fail("Test timed out"), 10_000); try { @@ -246,13 +246,13 @@ Deno.test({ "eval", ` import process from "node:process"; - console.log("ready"); setInterval(() => {}, 1000); const listener = () => { + process.off("SIGINT", listener); console.log("foo"); - process.off("SIGINT", listener) }; process.on("SIGINT", listener); + console.log("ready"); `, ], stdout: "piped", @@ -275,6 +275,7 @@ Deno.test({ while (!output.includes("foo\n")) { await delay(10); } + process.kill("SIGINT"); await process.status; } finally { clearTimeout(testTimeout); -- cgit v1.2.3