diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 75cc61b58..629605e0e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,7 +10,6 @@ extern crate rand; extern crate remove_dir_all; extern crate ring; extern crate rustyline; -extern crate serde_json; extern crate source_map_mappings; extern crate tempfile; extern crate tokio; @@ -27,7 +26,10 @@ extern crate lazy_static; extern crate log; #[macro_use] extern crate futures; +#[macro_use] +extern crate serde_json; +pub mod compiler; pub mod deno_dir; pub mod errors; pub mod flags; @@ -47,7 +49,7 @@ pub mod snapshot; mod tokio_util; mod tokio_write; pub mod version; -mod workers; +pub mod workers; #[cfg(unix)] mod eager_unix; @@ -100,10 +102,21 @@ fn main() { let state = Arc::new(isolate::IsolateState::new(flags, rest_argv, None)); let snapshot = snapshot::deno_snapshot(); let isolate = isolate::Isolate::new(snapshot, state, ops::dispatch); + tokio_util::init(|| { + // Setup runtime. isolate .execute("denoMain();") .unwrap_or_else(print_err_and_exit); + + // Execute input file. + if isolate.state.argv.len() > 1 { + let input_filename = &isolate.state.argv[1]; + isolate + .execute_mod(input_filename) + .unwrap_or_else(print_err_and_exit); + } + isolate.event_loop().unwrap_or_else(print_err_and_exit); }); } |