summaryrefslogtreecommitdiff
path: root/runtime/ops/spawn.rs
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/ops/spawn.rs')
-rw-r--r--runtime/ops/spawn.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/ops/spawn.rs b/runtime/ops/spawn.rs
index b337f2488..9286e6d0c 100644
--- a/runtime/ops/spawn.rs
+++ b/runtime/ops/spawn.rs
@@ -122,9 +122,13 @@ pub struct SpawnOutput {
fn create_command(
state: &mut OpState,
args: SpawnArgs,
+ api_name: &str,
) -> Result<std::process::Command, AnyError> {
super::check_unstable(state, "Deno.spawn");
- state.borrow_mut::<Permissions>().run.check(&args.cmd)?;
+ state
+ .borrow_mut::<Permissions>()
+ .run
+ .check(&args.cmd, Some(api_name))?;
let mut command = std::process::Command::new(args.cmd);
command.args(args.args);
@@ -185,8 +189,10 @@ struct Child {
fn op_spawn_child(
state: &mut OpState,
args: SpawnArgs,
+ api_name: String,
) -> Result<Child, AnyError> {
- let mut command = tokio::process::Command::from(create_command(state, args)?);
+ let mut command =
+ tokio::process::Command::from(create_command(state, args, &api_name)?);
// TODO(@crowlkats): allow detaching processes.
// currently deno will orphan a process when exiting with an error or Deno.exit()
// We want to kill child when it's closed
@@ -246,7 +252,7 @@ fn op_spawn_sync(
) -> Result<SpawnOutput, AnyError> {
let stdout = matches!(args.stdio.stdout, Stdio::Piped);
let stderr = matches!(args.stdio.stderr, Stdio::Piped);
- let output = create_command(state, args)?.output()?;
+ let output = create_command(state, args, "Deno.spawnSync()")?.output()?;
Ok(SpawnOutput {
status: output.status.try_into()?,