summaryrefslogtreecommitdiff
path: root/cli/lib.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-01-21 09:49:47 +0100
committerGitHub <noreply@github.com>2020-01-21 09:49:47 +0100
commit7966bf14c062a05b1606a62c996890571454ecc8 (patch)
tree65bede64b47707c3accc80d0bb18e99840c639f7 /cli/lib.rs
parentc90036ab88bb1ae6b9c87d5e368f56d8c8afab69 (diff)
refactor: split worker and worker host logic (#3722)
* split ops/worker.rs into ops/worker_host.rs and ops/web_worker.rs * refactor js/workers.ts and factor out js/worker_main.ts - entry point for WebWorker runtime * BREAKING CHANGE: remove support for blob: URL in Worker * BREAKING CHANGE: remove Deno namespace support and noDenoNamespace option in Worker constructor * introduce WebWorker struct which is a stripped down version of cli::Worker
Diffstat (limited to 'cli/lib.rs')
-rw-r--r--cli/lib.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/cli/lib.rs b/cli/lib.rs
index a57f224e2..e9a62375a 100644
--- a/cli/lib.rs
+++ b/cli/lib.rs
@@ -51,6 +51,7 @@ pub mod state;
pub mod test_util;
mod tokio_util;
pub mod version;
+mod web_worker;
pub mod worker;
use crate::deno_error::js_check;
@@ -120,7 +121,6 @@ fn create_worker_and_state(
global_state.clone(),
None,
global_state.main_module.clone(),
- true,
int,
)
.map_err(deno_error::print_err_and_exit)
@@ -346,16 +346,15 @@ fn bundle_command(flags: DenoFlags) {
fn run_repl(flags: DenoFlags) {
let (mut worker, _state) = create_worker_and_state(flags);
- // Make repl continue to function under uncaught async errors.
- worker.set_error_handler(Box::new(|err| {
- eprintln!("{}", err.to_string());
- Ok(())
- }));
- // Setup runtime.
js_check(worker.execute("denoMain()"));
let main_future = async move {
- let result = worker.await;
- js_check(result);
+ loop {
+ let result = worker.clone().await;
+ if let Err(err) = result {
+ eprintln!("{}", err.to_string());
+ worker.clear_exception();
+ }
+ }
};
tokio_util::run(main_future);
}