summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/process_test.ts24
1 files changed, 14 insertions, 10 deletions
diff --git a/cli/tests/unit/process_test.ts b/cli/tests/unit/process_test.ts
index 1eaa3c3b3..9bb4d7fc2 100644
--- a/cli/tests/unit/process_test.ts
+++ b/cli/tests/unit/process_test.ts
@@ -434,16 +434,20 @@ unitTest(
});
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,
+ let error = null;
+ try {
+ p.kill(Deno.Signal.SIGTERM);
+ } catch (e) {
+ error = e;
+ }
+
+ assert(
+ error instanceof Deno.errors.NotFound ||
+ // On Windows, the underlying Windows API may return
+ // `ERROR_ACCESS_DENIED` when the process has exited, but hasn't been
+ // completely cleaned up yet and its `pid` is still valid.
+ (Deno.build.os === "windows" &&
+ error instanceof Deno.errors.PermissionDenied),
);
p.close();