0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

Avoid --info crash on missing filename (#1660)

This commit is contained in:
Kevin (Kun) "Kassimo" Qian 2019-02-02 14:39:28 -08:00 committed by Ryan Dahl
parent 4b61170e22
commit c144733f72

View file

@ -88,15 +88,6 @@ fn main() {
let mut isolate = isolate::Isolate::new(snapshot, state, ops::dispatch);
tokio_util::init(|| {
// Requires tokio
if should_display_info {
isolate
.state
.dir
.print_file_info(isolate.state.argv[1].clone());
std::process::exit(0);
}
// Setup runtime.
isolate
.execute("denoMain();")
@ -106,6 +97,11 @@ fn main() {
// Execute input file.
if isolate.state.argv.len() > 1 {
let input_filename = isolate.state.argv[1].clone();
if should_display_info {
// Display file info and exit. Do not run file
isolate.state.dir.print_file_info(input_filename);
std::process::exit(0);
}
isolate
.execute_mod(&input_filename, should_prefetch)
.unwrap_or_else(print_err_and_exit);