diff options
Diffstat (limited to 'cli/main.rs')
-rw-r--r-- | cli/main.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/cli/main.rs b/cli/main.rs index 05748f5ab..8121e5f7c 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -35,6 +35,7 @@ mod progress; mod repl; pub mod resolve_addr; pub mod resources; +mod shell; mod signal; pub mod source_maps; mod startup_data; @@ -158,17 +159,15 @@ fn create_worker_and_state( flags: DenoFlags, argv: Vec<String>, ) -> (Worker, ThreadSafeState) { + use crate::shell::Shell; + use std::sync::Arc; + use std::sync::Mutex; + let shell = Arc::new(Mutex::new(Shell::new())); let progress = Progress::new(); - progress.set_callback(|done, completed, total, msg| { - if !done { - eprint!("\r[{}/{}] {}", completed, total, msg); - eprint!("\x1B[K"); // Clear to end of line. - return; - } - - // print empty line only if progress bar was used - if done && total > 0 { - eprintln!(); + progress.set_callback(move |_done, _completed, _total, status, msg| { + if !status.is_empty() { + let mut s = shell.lock().unwrap(); + s.status(status, msg).expect("shell problem"); } }); let state = ThreadSafeState::new(flags, argv, ops::op_selector_std, progress); |