diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2021-11-28 00:45:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-28 00:45:38 +0100 |
commit | 993a1dd41ae5f96bdb24b09757e24c2ac24126d0 (patch) | |
tree | 8b6c0d4de8f8101bf8a3c31fe4f163d18c2c298e /cli/main.rs | |
parent | 1d3f734e1815bf1649e0cac445be9eacb4cd296d (diff) |
feat(runtime): add op_set_exit_code (#12911)
Set the exit code to use if none is provided to Deno.exit(), or when
Deno exits naturally.
Needed for process.exitCode Node compat. Paves the way for #12888.
Diffstat (limited to 'cli/main.rs')
-rw-r--r-- | cli/main.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cli/main.rs b/cli/main.rs index e2ef26cd3..3d8a80cee 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -93,6 +93,7 @@ use std::iter::once; use std::path::PathBuf; use std::pin::Pin; use std::rc::Rc; +use std::sync::atomic::Ordering::Relaxed; use std::sync::Arc; fn create_web_worker_callback(ps: ProcState) -> Arc<CreateWebWorkerCb> { @@ -1475,4 +1476,7 @@ pub fn main() { logger::init(flags.log_level); unwrap_or_exit(run_basic(get_subcommand(flags))); + + let code = deno_runtime::EXIT_CODE.load(Relaxed); + std::process::exit(code); } |