From 3451c5fb55528427a8417fbceea86dc187fc93c5 Mon Sep 17 00:00:00 2001 From: "Kevin (Kun) \"Kassimo\" Qian" Date: Tue, 26 Nov 2019 20:25:14 -0800 Subject: Tweaks to arg_hacks and add v8-flags to repl (#3409) --- cli/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cli/lib.rs') diff --git a/cli/lib.rs b/cli/lib.rs index 7328d9d26..c0bf57b5b 100644 --- a/cli/lib.rs +++ b/cli/lib.rs @@ -53,7 +53,7 @@ pub mod version; pub mod worker; use crate::deno_error::js_check; -use crate::deno_error::print_err_and_exit; +use crate::deno_error::{print_err_and_exit, print_msg_and_exit}; use crate::global_state::ThreadSafeGlobalState; use crate::ops::io::get_stdio; use crate::progress::Progress; @@ -365,7 +365,11 @@ fn run_script(flags: DenoFlags) { let use_current_thread = flags.current_thread; let (mut worker, state) = create_worker_and_state(flags); - let main_module = state.main_module.as_ref().unwrap().clone(); + let maybe_main_module = state.main_module.as_ref(); + if maybe_main_module.is_none() { + print_msg_and_exit("Please provide a name to the main script to run."); + } + let main_module = maybe_main_module.unwrap().clone(); // Normal situation of executing a module. // Setup runtime. -- cgit v1.2.3