diff options
Diffstat (limited to 'cli/ops/process.rs')
-rw-r--r-- | cli/ops/process.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/cli/ops/process.rs b/cli/ops/process.rs index e93bcbc0f..fe461bd28 100644 --- a/cli/ops/process.rs +++ b/cli/ops/process.rs @@ -1,7 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use super::dispatch_json::{Deserialize, JsonOp, Value}; use super::io::StreamResource; -use crate::deno_error::bad_resource; +use crate::op_error::OpError; use crate::ops::json_op; use crate::signal::kill; use crate::state::State; @@ -30,15 +30,15 @@ pub fn init(i: &mut Isolate, s: &State) { i.register_op("kill", s.core_op(json_op(s.stateful_op(op_kill)))); } -fn clone_file(rid: u32, state: &State) -> Result<std::fs::File, ErrBox> { +fn clone_file(rid: u32, state: &State) -> Result<std::fs::File, OpError> { let mut state = state.borrow_mut(); let repr = state .resource_table .get_mut::<StreamResource>(rid) - .ok_or_else(bad_resource)?; + .ok_or_else(OpError::bad_resource)?; let file = match repr { StreamResource::FsFile(ref mut file) => file, - _ => return Err(bad_resource()), + _ => return Err(OpError::bad_resource()), }; let tokio_file = futures::executor::block_on(file.try_clone())?; let std_file = futures::executor::block_on(tokio_file.into_std()); @@ -76,7 +76,7 @@ fn op_run( state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, -) -> Result<JsonOp, ErrBox> { +) -> Result<JsonOp, OpError> { let run_args: RunArgs = serde_json::from_value(args)?; state.check_run()?; @@ -182,7 +182,7 @@ pub struct ChildStatus { } impl Future for ChildStatus { - type Output = Result<ExitStatus, ErrBox>; + type Output = Result<ExitStatus, OpError>; fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> { let inner = self.get_mut(); @@ -190,9 +190,9 @@ impl Future for ChildStatus { let child_resource = state .resource_table .get_mut::<ChildResource>(inner.rid) - .ok_or_else(bad_resource)?; + .ok_or_else(OpError::bad_resource)?; let child = &mut child_resource.child; - child.map_err(ErrBox::from).poll_unpin(cx) + child.map_err(OpError::from).poll_unpin(cx) } } @@ -206,7 +206,7 @@ fn op_run_status( state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, -) -> Result<JsonOp, ErrBox> { +) -> Result<JsonOp, OpError> { let args: RunStatusArgs = serde_json::from_value(args)?; let rid = args.rid as u32; @@ -251,7 +251,7 @@ fn op_kill( state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, -) -> Result<JsonOp, ErrBox> { +) -> Result<JsonOp, OpError> { state.check_run()?; let args: KillArgs = serde_json::from_value(args)?; |