diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-05-11 10:23:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-11 10:23:19 -0400 |
commit | aba952397ae668714add770c5b6fa6edf1cf3eb5 (patch) | |
tree | a1d2f0bd9758cdd5b196e3ed8efc12c657795aab /cli/compiler.rs | |
parent | 2c6b93e0a0c7927dc4dd66c1f681a78a6d79b8f1 (diff) |
Add progress bar (#2309)
Diffstat (limited to 'cli/compiler.rs')
-rw-r--r-- | cli/compiler.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cli/compiler.rs b/cli/compiler.rs index 522002b0b..d4913a4e2 100644 --- a/cli/compiler.rs +++ b/cli/compiler.rs @@ -95,6 +95,7 @@ fn lazy_start(parent_state: ThreadSafeState) -> ResourceId { parent_state.flags.clone(), parent_state.argv.clone(), op_selector_compiler, + parent_state.progress.clone(), ); let rid = child_state.resource.rid; let resource = child_state.resource.clone(); @@ -192,6 +193,10 @@ pub fn compile_async( let compiler_rid = lazy_start(parent_state.clone()); + let compiling_job = parent_state + .progress + .add(format!("Compiling {}", module_meta_data_.module_name)); + let (local_sender, local_receiver) = oneshot::channel::<Result<ModuleMetaData, Option<JSError>>>(); @@ -218,6 +223,10 @@ pub fn compile_async( let res_data = res["data"].as_object().expect( "Error decoding compiler response: expected object field 'data'", ); + + // Explicit drop to keep reference alive until future completes. + drop(compiling_job); + match res["success"].as_bool() { Some(true) => Ok(ModuleMetaData { maybe_output_code: res_data["outputCode"] |