diff options
author | Bert Belder <bertbelder@gmail.com> | 2021-10-07 16:31:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-07 16:31:02 +0200 |
commit | 822047b845d083721eb22663c98692d341bde648 (patch) | |
tree | c684fdcf4b3cd6e746e90c1f6a51ecc632b136f7 | |
parent | c4b995ffe64728dd47a5ef0cbb47fc513e7a756e (diff) |
fix(runtime): don't equate SIGINT to SIGKILL on Windows (#12356)
-rw-r--r-- | cli/tests/unit/process_test.ts | 8 | ||||
-rw-r--r-- | runtime/ops/process.rs | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/cli/tests/unit/process_test.ts b/cli/tests/unit/process_test.ts index 12946656d..8ac843973 100644 --- a/cli/tests/unit/process_test.ts +++ b/cli/tests/unit/process_test.ts @@ -476,7 +476,7 @@ unitTest( { ignore: Deno.build.os !== "windows", permissions: { run: true } }, function negativePidInvalidWindows() { assertThrows(() => { - Deno.kill(-1, "SIGINT"); + Deno.kill(-1, "SIGTERM"); }, TypeError); }, ); @@ -498,7 +498,7 @@ unitTest( }); try { - Deno.kill(p.pid, "SIGINT"); + Deno.kill(p.pid, "SIGKILL"); const status = await p.status(); assertEquals(status.success, false); @@ -506,8 +506,8 @@ unitTest( assertEquals(status.code, 1); assertEquals(status.signal, undefined); } else { - assertEquals(status.code, 130); - assertEquals(status.signal, 2); + assertEquals(status.code, 137); + assertEquals(status.signal, 9); } } finally { p.close(); diff --git a/runtime/ops/process.rs b/runtime/ops/process.rs index 7b01916b4..f6a472590 100644 --- a/runtime/ops/process.rs +++ b/runtime/ops/process.rs @@ -280,7 +280,7 @@ pub fn kill(pid: i32, signal: &str) -> Result<(), AnyError> { use winapi::um::processthreadsapi::TerminateProcess; use winapi::um::winnt::PROCESS_TERMINATE; - if !matches!(signal, "SIGINT" | "SIGKILL" | "SIGTERM") { + if !matches!(signal, "SIGKILL" | "SIGTERM") { Err(type_error(format!("Invalid signal: {}", signal))) } else if pid <= 0 { Err(type_error("Invalid pid")) |