diff options
Diffstat (limited to 'cli/main.rs')
-rw-r--r-- | cli/main.rs | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/cli/main.rs b/cli/main.rs index 08746042c..8c0dd0354 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -31,43 +31,19 @@ use crate::args::Flags; use crate::proc_state::ProcState; use crate::resolver::CliResolver; use crate::util::display; +use crate::util::v8::get_v8_flags_from_env; +use crate::util::v8::init_v8_flags; use args::CliOptions; use deno_core::anyhow::Context; use deno_core::error::AnyError; use deno_core::error::JsError; -use deno_core::v8_set_flags; use deno_runtime::colors; use deno_runtime::fmt_errors::format_js_error; use deno_runtime::tokio_util::run_local; use std::env; -use std::iter::once; use std::path::PathBuf; -fn init_v8_flags(v8_flags: &[String]) { - let v8_flags_includes_help = v8_flags - .iter() - .any(|flag| flag == "-help" || flag == "--help"); - // Keep in sync with `standalone.rs`. - let v8_flags = once("UNUSED_BUT_NECESSARY_ARG0".to_owned()) - .chain(v8_flags.iter().cloned()) - .collect::<Vec<_>>(); - let unrecognized_v8_flags = v8_set_flags(v8_flags) - .into_iter() - .skip(1) - .collect::<Vec<_>>(); - if !unrecognized_v8_flags.is_empty() { - for f in unrecognized_v8_flags { - eprintln!("error: V8 did not recognize flag '{}'", f); - } - eprintln!("\nFor a list of V8 flags, use '--v8-flags=--help'"); - std::process::exit(1); - } - if v8_flags_includes_help { - std::process::exit(0); - } -} - async fn run_subcommand(flags: Flags) -> Result<i32, AnyError> { match flags.subcommand.clone() { DenoSubcommand::Bench(bench_flags) => { @@ -285,9 +261,8 @@ pub fn main() { } Err(err) => unwrap_or_exit(Err(AnyError::from(err))), }; - if !flags.v8_flags.is_empty() { - init_v8_flags(&flags.v8_flags); - } + + init_v8_flags(&flags.v8_flags, get_v8_flags_from_env()); util::logger::init(flags.log_level); |