diff options
Diffstat (limited to 'runtime/ops/process.rs')
-rw-r--r-- | runtime/ops/process.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/runtime/ops/process.rs b/runtime/ops/process.rs index a60b451eb..c9715039b 100644 --- a/runtime/ops/process.rs +++ b/runtime/ops/process.rs @@ -8,7 +8,6 @@ use crate::permissions::Permissions; use deno_core::error::bad_resource_id; use deno_core::error::type_error; use deno_core::error::AnyError; -use deno_core::serde_json; use deno_core::serde_json::json; use deno_core::serde_json::Value; use deno_core::AsyncMutFuture; @@ -54,7 +53,7 @@ fn subprocess_stdio_map(s: &str) -> Result<std::process::Stdio, AnyError> { #[derive(Deserialize)] #[serde(rename_all = "camelCase")] -struct RunArgs { +pub struct RunArgs { cmd: Vec<String>, cwd: Option<String>, env: Vec<(String, String)>, @@ -84,10 +83,9 @@ impl ChildResource { fn op_run( state: &mut OpState, - args: Value, + run_args: RunArgs, _zero_copy: &mut [ZeroCopyBuf], ) -> Result<Value, AnyError> { - let run_args: RunArgs = serde_json::from_value(args)?; state.borrow::<Permissions>().run.check()?; let args = run_args.cmd; @@ -179,16 +177,15 @@ fn op_run( #[derive(Deserialize)] #[serde(rename_all = "camelCase")] -struct RunStatusArgs { +pub struct RunStatusArgs { rid: i32, } async fn op_run_status( state: Rc<RefCell<OpState>>, - args: Value, + args: RunStatusArgs, _zero_copy: BufVec, ) -> Result<Value, AnyError> { - let args: RunStatusArgs = serde_json::from_value(args)?; let rid = args.rid as u32; { @@ -281,13 +278,12 @@ struct KillArgs { fn op_kill( state: &mut OpState, - args: Value, + args: KillArgs, _zero_copy: &mut [ZeroCopyBuf], ) -> Result<Value, AnyError> { super::check_unstable(state, "Deno.kill"); state.borrow::<Permissions>().run.check()?; - let args: KillArgs = serde_json::from_value(args)?; kill(args.pid, args.signo)?; Ok(json!({})) } |