summaryrefslogtreecommitdiff
path: root/cli/ops/os.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-01-28 03:12:25 +0100
committerRyan Dahl <ry@tinyclouds.org>2020-01-27 21:12:25 -0500
commitac10d79d231d3b66b918764b9706597321850687 (patch)
tree6a781c58075ee0c68091e71d2ffd2bb898dc9dfd /cli/ops/os.rs
parentf604becaba0c747fdf8dd9d0d744c7bd19322e41 (diff)
refactor: isomorphic snapshot for CLI (#3728)
Diffstat (limited to 'cli/ops/os.rs')
-rw-r--r--cli/ops/os.rs41
1 files changed, 0 insertions, 41 deletions
diff --git a/cli/ops/os.rs b/cli/ops/os.rs
index ffc453bc6..ce2320d92 100644
--- a/cli/ops/os.rs
+++ b/cli/ops/os.rs
@@ -1,10 +1,7 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use super::dispatch_json::{Deserialize, JsonOp, Value};
-use crate::colors;
-use crate::fs as deno_fs;
use crate::ops::json_op;
use crate::state::ThreadSafeState;
-use crate::version;
use atty;
use deno_core::*;
use std::collections::HashMap;
@@ -13,16 +10,6 @@ use std::io::{Error, ErrorKind};
use sys_info;
use url::Url;
-/// BUILD_OS and BUILD_ARCH match the values in Deno.build. See js/build.ts.
-#[cfg(target_os = "macos")]
-static BUILD_OS: &str = "mac";
-#[cfg(target_os = "linux")]
-static BUILD_OS: &str = "linux";
-#[cfg(target_os = "windows")]
-static BUILD_OS: &str = "win";
-#[cfg(target_arch = "x86_64")]
-static BUILD_ARCH: &str = "x64";
-
pub fn init(i: &mut Isolate, s: &ThreadSafeState) {
i.register_op("exit", s.core_op(json_op(s.stateful_op(op_exit))));
i.register_op("is_tty", s.core_op(json_op(s.stateful_op(op_is_tty))));
@@ -32,34 +19,6 @@ pub fn init(i: &mut Isolate, s: &ThreadSafeState) {
i.register_op("get_env", s.core_op(json_op(s.stateful_op(op_get_env))));
i.register_op("get_dir", s.core_op(json_op(s.stateful_op(op_get_dir))));
i.register_op("hostname", s.core_op(json_op(s.stateful_op(op_hostname))));
- i.register_op("start", s.core_op(json_op(s.stateful_op(op_start))));
-}
-
-fn op_start(
- state: &ThreadSafeState,
- _args: Value,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<JsonOp, ErrBox> {
- let gs = &state.global_state;
- let script_args = if gs.flags.argv.len() >= 2 {
- gs.flags.argv.clone().split_off(2)
- } else {
- vec![]
- };
- Ok(JsonOp::Sync(json!({
- "cwd": deno_fs::normalize_path(&env::current_dir().unwrap()),
- "pid": std::process::id(),
- "argv": script_args,
- "mainModule": gs.main_module.as_ref().map(|x| x.to_string()),
- "debugFlag": gs.flags.log_level.map_or(false, |l| l == log::Level::Debug),
- "versionFlag": gs.flags.version,
- "v8Version": version::v8(),
- "denoVersion": version::DENO,
- "tsVersion": version::TYPESCRIPT,
- "noColor": !colors::use_color(),
- "os": BUILD_OS,
- "arch": BUILD_ARCH,
- })))
}
#[derive(Deserialize)]