diff options
author | Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> | 2024-03-11 10:22:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-11 10:22:28 -0700 |
commit | 28b362adfc49324e20af5ecb1530f89eb91c4ed5 (patch) | |
tree | c0e5cc5b08d13a2a10f2f72281996090356af61c /tests/unit_node/process_test.ts | |
parent | 670e9a9be78e15c2800541aeba62d7cba6a4d58d (diff) |
fix(runtime): Restore default signal handler after user handlers are unregistered (#22757)
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/contributing
1. Give the PR a descriptive title.
Examples of good title:
- fix(std/http): Fix race condition in server
- docs(console): Update docstrings
- feat(doc): Handle nested reexports
Examples of bad title:
- fix #7123
- update docs
- fix bugs
2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->
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.
Diffstat (limited to 'tests/unit_node/process_test.ts')
-rw-r--r-- | tests/unit_node/process_test.ts | 7 |
1 files changed, 4 insertions, 3 deletions
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); |