From 97d8498d46bbfb7bb16eeb3a69565d2aeda1e5aa Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 11 Oct 2019 11:41:54 -0700 Subject: Add init methods for each op module (#3087) --- cli/ops/process.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'cli/ops/process.rs') diff --git a/cli/ops/process.rs b/cli/ops/process.rs index 8dff53c6e..5b59aa030 100644 --- a/cli/ops/process.rs +++ b/cli/ops/process.rs @@ -1,5 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. use super::dispatch_json::{Deserialize, JsonOp, Value}; +use crate::ops::json_op; use crate::resources; use crate::signal::kill; use crate::state::ThreadSafeState; @@ -14,6 +15,15 @@ use tokio_process::CommandExt; #[cfg(unix)] use std::os::unix::process::ExitStatusExt; +pub fn init(i: &mut Isolate, s: &ThreadSafeState) { + i.register_op("run", s.core_op(json_op(s.stateful_op(op_run)))); + i.register_op( + "run_status", + s.core_op(json_op(s.stateful_op(op_run_status))), + ); + i.register_op("kill", s.core_op(json_op(s.stateful_op(op_kill)))); +} + fn subprocess_stdio_map(s: &str) -> std::process::Stdio { match s { "inherit" => std::process::Stdio::inherit(), @@ -37,7 +47,7 @@ struct RunArgs { stderr_rid: u32, } -pub fn op_run( +fn op_run( state: &ThreadSafeState, args: Value, _zero_copy: Option, @@ -103,7 +113,7 @@ struct RunStatusArgs { rid: i32, } -pub fn op_run_status( +fn op_run_status( state: &ThreadSafeState, args: Value, _zero_copy: Option, @@ -144,7 +154,7 @@ struct KillArgs { signo: i32, } -pub fn op_kill( +fn op_kill( state: &ThreadSafeState, args: Value, _zero_copy: Option, -- cgit v1.2.3