1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

fix(runtime): don't equate SIGINT to SIGKILL on Windows (#12356)

This commit is contained in:
Bert Belder 2021-10-07 16:31:02 +02:00 committed by GitHub
parent c4b995ffe6
commit 822047b845
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -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();

View file

@ -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"))