diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-09-09 22:40:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-09 22:40:16 +0200 |
commit | 2423a867c0540edc5535a21559e6319d920e1376 (patch) | |
tree | 3c476cc0a084e34cea3a87db429f176fcd1d0506 /cli/tests/unit/process_test.ts | |
parent | 839c59b14f062649ebfad702658b271830dcbb50 (diff) |
fix: panic on process.kill() after run (#7405)
This commit fixes panic caused by "unimplemented!()"
calls for some variants of "nix::errno::Errno".
Catch-all variant now returns "Error" class name
instead of panicking.
Co-authored-by: Bert Belder <bertbelder@gmail.com>
Diffstat (limited to 'cli/tests/unit/process_test.ts')
-rw-r--r-- | cli/tests/unit/process_test.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cli/tests/unit/process_test.ts b/cli/tests/unit/process_test.ts index 5b7844970..76b755295 100644 --- a/cli/tests/unit/process_test.ts +++ b/cli/tests/unit/process_test.ts @@ -375,6 +375,30 @@ unitTest({ perms: { run: true } }, async function runClose(): Promise<void> { p.stderr.close(); }); +unitTest( + { perms: { run: true } }, + async function runKillAfterStatus(): Promise<void> { + const p = Deno.run({ + cmd: ["python", "-c", 'print("hello")'], + }); + await p.status(); + + // On Windows the underlying Rust API returns `ERROR_ACCESS_DENIED`, + // which serves kind of as a catch all error code. More specific + // error codes do exist, e.g. `ERROR_WAIT_NO_CHILDREN`; it's unclear + // why they're not returned. + const expectedErrorType = Deno.build.os === "windows" + ? Deno.errors.PermissionDenied + : Deno.errors.NotFound; + assertThrows( + () => p.kill(Deno.Signal.SIGTERM), + expectedErrorType, + ); + + p.close(); + }, +); + unitTest(function signalNumbers(): void { if (Deno.build.os === "darwin") { assertEquals(Deno.Signal.SIGSTOP, 17); |