summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/tests/integration/run_tests.rs5
-rw-r--r--cli/tests/testdata/spawn_kill_permissions.ts6
-rw-r--r--cli/tests/unit/command_test.ts18
3 files changed, 29 insertions, 0 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs
index 26aacc6fd..e6ea85da4 100644
--- a/cli/tests/integration/run_tests.rs
+++ b/cli/tests/integration/run_tests.rs
@@ -3435,6 +3435,11 @@ itest!(test_and_bench_are_noops_in_run {
output_str: Some(""),
});
+itest!(spawn_kill_permissions {
+ args: "run --quiet --unstable --allow-run=deno spawn_kill_permissions.ts",
+ output_str: Some(""),
+});
+
itest!(followup_dyn_import_resolved {
args: "run --unstable --allow-read run/followup_dyn_import_resolves/main.ts",
output: "run/followup_dyn_import_resolves/main.ts.out",
diff --git a/cli/tests/testdata/spawn_kill_permissions.ts b/cli/tests/testdata/spawn_kill_permissions.ts
new file mode 100644
index 000000000..e0c1b7bfd
--- /dev/null
+++ b/cli/tests/testdata/spawn_kill_permissions.ts
@@ -0,0 +1,6 @@
+const child = new Deno.Command("deno", {
+ args: ["eval", "await new Promise(r => setTimeout(r, 2000))"],
+ stdout: "null",
+ stderr: "null",
+}).spawn();
+child.kill("SIGTERM");
diff --git a/cli/tests/unit/command_test.ts b/cli/tests/unit/command_test.ts
index 0763a7ac6..198f94aed 100644
--- a/cli/tests/unit/command_test.ts
+++ b/cli/tests/unit/command_test.ts
@@ -867,3 +867,21 @@ Deno.test(
}
},
);
+
+Deno.test(
+ { permissions: { run: true, read: true } },
+ async function commandKillAfterStatus() {
+ const command = new Deno.Command(Deno.execPath(), {
+ args: ["help"],
+ stdout: "null",
+ stderr: "null",
+ });
+ const child = command.spawn();
+ await child.status;
+ assertThrows(
+ () => child.kill(),
+ TypeError,
+ "Child process has already terminated.",
+ );
+ },
+);