diff options
author | Matt Mastracci <matthew@mastracci.com> | 2023-12-24 06:44:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-24 14:44:40 +0100 |
commit | 8702894feb480181040152a06e7c3eaf38619629 (patch) | |
tree | c4b988ca133502975efbae88cac26d12ed287159 /runtime/worker.rs | |
parent | e1bfb29868cf49b949560bc3328ea824400a1319 (diff) |
chore: bump deno_core (#21675)
Diffstat (limited to 'runtime/worker.rs')
-rw-r--r-- | runtime/worker.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/runtime/worker.rs b/runtime/worker.rs index 549a6cdd6..237ebfe13 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -1,5 +1,6 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. use std::rc::Rc; +use std::sync::atomic::AtomicBool; use std::sync::atomic::AtomicI32; use std::sync::atomic::Ordering::Relaxed; use std::sync::Arc; @@ -418,6 +419,15 @@ impl MainWorker { #[cfg(all(feature = "include_js_files_for_snapshotting", feature = "dont_create_runtime_snapshot", not(feature = "__runtime_js_sources")))] options.startup_snapshot.as_ref().expect("Sources are not embedded, snapshotting was disabled and a user snapshot was not provided."); + let has_notified_of_inspector_disconnect = AtomicBool::new(false); + let wait_for_inspector_disconnect_callback = Box::new(move || { + if !has_notified_of_inspector_disconnect + .swap(true, std::sync::atomic::Ordering::SeqCst) + { + println!("Program finished. Waiting for inspector to disconnect to exit the process..."); + } + }); + let mut js_runtime = JsRuntime::new(RuntimeOptions { module_loader: Some(options.module_loader.clone()), startup_snapshot: options @@ -434,6 +444,9 @@ impl MainWorker { is_main: true, feature_checker: Some(options.feature_checker.clone()), op_metrics_factory_fn, + wait_for_inspector_disconnect_callback: Some( + wait_for_inspector_disconnect_callback, + ), ..Default::default() }); |