0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-30 11:15:13 -05:00
denoland-deno/src/main.rs

71 lines
1.4 KiB
Rust
Raw Normal View History

// Copyright 2018 the Deno authors. All rights reserved. MIT license.
extern crate flatbuffers;
#[macro_use]
extern crate futures;
extern crate hyper;
2018-07-26 17:54:22 -04:00
extern crate libc;
2018-09-09 19:21:22 -04:00
extern crate msg_rs as msg;
2018-08-24 00:36:45 +02:00
extern crate rand;
2018-07-24 01:45:23 -04:00
extern crate tempfile;
extern crate tokio;
extern crate tokio_executor;
extern crate tokio_fs;
extern crate tokio_io;
2018-09-22 04:42:07 -04:00
extern crate tokio_threadpool;
extern crate url;
2018-07-26 17:54:22 -04:00
#[macro_use]
extern crate lazy_static;
#[macro_use]
2018-07-26 17:54:22 -04:00
extern crate log;
extern crate dirs;
extern crate hyper_rustls;
extern crate remove_dir_all;
extern crate ring;
2018-07-26 17:54:22 -04:00
mod deno_dir;
mod errors;
mod flags;
2018-07-26 17:54:22 -04:00
mod fs;
mod http;
mod isolate;
mod libdeno;
2018-10-03 20:48:02 -04:00
pub mod ops;
mod resources;
mod tokio_util;
mod version;
2018-07-04 14:50:28 -04:00
2018-07-25 18:27:27 -07:00
use std::env;
static LOGGER: Logger = Logger;
struct Logger;
impl log::Log for Logger {
fn enabled(&self, metadata: &log::Metadata) -> bool {
2018-08-07 13:33:36 -04:00
metadata.level() <= log::max_level()
}
fn log(&self, record: &log::Record) {
if self.enabled(record.metadata()) {
println!("{} RS - {}", record.level(), record.args());
}
}
fn flush(&self) {}
}
2018-06-16 01:43:23 +02:00
fn main() {
log::set_logger(&LOGGER).unwrap();
2018-09-22 01:03:24 -04:00
let args = env::args().collect();
2018-10-03 20:48:02 -04:00
let mut isolate = isolate::Isolate::new(args, ops::msg_from_js);
flags::process(&isolate.state.flags);
tokio_util::init(|| {
isolate
.execute("deno_main.js", "denoMain();")
.unwrap_or_else(|err| {
error!("{}", err);
std::process::exit(1);
});
isolate.event_loop();
});
2018-06-16 01:43:23 +02:00
}