diff --git a/Cargo.lock b/Cargo.lock index 8c0383fb0d..a031494c22 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1134,9 +1134,9 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.238.0" +version = "0.239.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ded8b759e4435aa0929913909dd6c482ed6042dae19c53260e1caf9d55b37a9" +checksum = "c7765fb48adcbe8949483afc28dc39de500a5464eb3b4b211d2920aca1af236b" dependencies = [ "anyhow", "bytes", @@ -1569,9 +1569,9 @@ dependencies = [ [[package]] name = "deno_ops" -version = "0.114.0" +version = "0.115.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168a929496191fdd8e91f898c8454429df4d5489597777d89f47897f6a37da6b" +checksum = "c81860fa6e339f5db9bfbf55503300b8b86c7bbdfde70bf9fcfa57624e1b0eef" dependencies = [ "proc-macro-rules", "proc-macro2", @@ -5155,9 +5155,9 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.147.0" +version = "0.148.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af950d83e1c70b762d48fa7a869d6db9a4f191548dfd666fa4e62f2229e1dce" +checksum = "29fc23773946897ae2bc9db186b27103d35d35591bfa541d5570a30de14c72f2" dependencies = [ "bytes", "derive_more", diff --git a/Cargo.toml b/Cargo.toml index b58977b787..37569f876e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ repository = "https://github.com/denoland/deno" [workspace.dependencies] deno_ast = { version = "0.31.6", features = ["transpiling"] } -deno_core = { version = "0.238.0" } +deno_core = { version = "0.239.0" } deno_runtime = { version = "0.137.0", path = "./runtime" } napi_sym = { version = "0.59.0", path = "./cli/napi/sym" } diff --git a/runtime/worker.rs b/runtime/worker.rs index 549a6cdd69..237ebfe13b 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() });