summaryrefslogtreecommitdiff
path: root/cli/ops/os.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/ops/os.rs')
-rw-r--r--cli/ops/os.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/cli/ops/os.rs b/cli/ops/os.rs
index e46aff3e6..1b961164e 100644
--- a/cli/ops/os.rs
+++ b/cli/ops/os.rs
@@ -1,8 +1,8 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use super::dispatch_json::{Deserialize, JsonOp, Value};
-use crate::op_error::OpError;
use crate::state::State;
use deno_core::CoreIsolate;
+use deno_core::ErrBox;
use deno_core::ZeroCopyBuf;
use std::collections::HashMap;
use std::env;
@@ -25,7 +25,7 @@ fn op_exec_path(
state: &Rc<State>,
_args: Value,
_zero_copy: &mut [ZeroCopyBuf],
-) -> Result<JsonOp, OpError> {
+) -> Result<JsonOp, ErrBox> {
let current_exe = env::current_exe().unwrap();
state.check_read_blind(&current_exe, "exec_path")?;
// Now apply URL parser to current exe to get fully resolved path, otherwise
@@ -45,7 +45,7 @@ fn op_set_env(
state: &Rc<State>,
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
-) -> Result<JsonOp, OpError> {
+) -> Result<JsonOp, ErrBox> {
let args: SetEnv = serde_json::from_value(args)?;
state.check_env()?;
env::set_var(args.key, args.value);
@@ -56,7 +56,7 @@ fn op_env(
state: &Rc<State>,
_args: Value,
_zero_copy: &mut [ZeroCopyBuf],
-) -> Result<JsonOp, OpError> {
+) -> Result<JsonOp, ErrBox> {
state.check_env()?;
let v = env::vars().collect::<HashMap<String, String>>();
Ok(JsonOp::Sync(json!(v)))
@@ -71,7 +71,7 @@ fn op_get_env(
state: &Rc<State>,
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
-) -> Result<JsonOp, OpError> {
+) -> Result<JsonOp, ErrBox> {
let args: GetEnv = serde_json::from_value(args)?;
state.check_env()?;
let r = match env::var(args.key) {
@@ -90,7 +90,7 @@ fn op_delete_env(
state: &Rc<State>,
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
-) -> Result<JsonOp, OpError> {
+) -> Result<JsonOp, ErrBox> {
let args: DeleteEnv = serde_json::from_value(args)?;
state.check_env()?;
env::remove_var(args.key);
@@ -106,7 +106,7 @@ fn op_exit(
_s: &Rc<State>,
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
-) -> Result<JsonOp, OpError> {
+) -> Result<JsonOp, ErrBox> {
let args: Exit = serde_json::from_value(args)?;
std::process::exit(args.code)
}
@@ -115,7 +115,7 @@ fn op_loadavg(
state: &Rc<State>,
_args: Value,
_zero_copy: &mut [ZeroCopyBuf],
-) -> Result<JsonOp, OpError> {
+) -> Result<JsonOp, ErrBox> {
state.check_unstable("Deno.loadavg");
state.check_env()?;
match sys_info::loadavg() {
@@ -132,7 +132,7 @@ fn op_hostname(
state: &Rc<State>,
_args: Value,
_zero_copy: &mut [ZeroCopyBuf],
-) -> Result<JsonOp, OpError> {
+) -> Result<JsonOp, ErrBox> {
state.check_unstable("Deno.hostname");
state.check_env()?;
let hostname = sys_info::hostname().unwrap_or_else(|_| "".to_string());
@@ -143,7 +143,7 @@ fn op_os_release(
state: &Rc<State>,
_args: Value,
_zero_copy: &mut [ZeroCopyBuf],
-) -> Result<JsonOp, OpError> {
+) -> Result<JsonOp, ErrBox> {
state.check_unstable("Deno.osRelease");
state.check_env()?;
let release = sys_info::os_release().unwrap_or_else(|_| "".to_string());