diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2021-12-11 15:56:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-11 15:56:45 +0100 |
commit | 0dec9b4381e0aa1d4b75ab5837cb75598f19c727 (patch) | |
tree | 960f9bd48c5b733317c5592d9843f315883413f8 /runtime/lib.rs | |
parent | 13d7d5722771bf8c4de7083dc0f964dfffcb318a (diff) |
fix: op_set_exit_code (#13034)
Fixes "op_set_exit_code" by sharing a single "Arc" between
all workers (via "op state") instead of having a "global" value stored in
"deno_runtime" crate. As a consequence setting an exit code is always
scoped to a tree of workers, instead of being overridable if there are
multiple worker tree (like in "deno test --jobs" subcommand).
Refactored "cli/main.rs" functions to return "Result<i32, AnyError>" instead
of "Result<(), AnyError>" so they can return exit code.
Diffstat (limited to 'runtime/lib.rs')
-rw-r--r-- | runtime/lib.rs | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/runtime/lib.rs b/runtime/lib.rs index ad4a790da..58de3725b 100644 --- a/runtime/lib.rs +++ b/runtime/lib.rs @@ -1,7 +1,5 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -use std::sync::atomic::AtomicI32; - pub use deno_broadcast_channel; pub use deno_console; pub use deno_core; @@ -32,12 +30,3 @@ pub mod worker; mod worker_bootstrap; pub use worker_bootstrap::BootstrapOptions; - -// The global may not be very elegant but: -// -// 1. op_exit() calls std::process::exit() so there is not much point storing -// the exit code in runtime state -// -// 2. storing it in runtime state makes retrieving it again in cli/main.rs -// unduly complicated -pub static EXIT_CODE: AtomicI32 = AtomicI32::new(0); |