From 0dec9b4381e0aa1d4b75ab5837cb75598f19c727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sat, 11 Dec 2021 15:56:45 +0100 Subject: 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" instead of "Result<(), AnyError>" so they can return exit code. --- cli/tools/repl/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cli/tools') diff --git a/cli/tools/repl/mod.rs b/cli/tools/repl/mod.rs index 047b477cf..687e8a300 100644 --- a/cli/tools/repl/mod.rs +++ b/cli/tools/repl/mod.rs @@ -747,7 +747,7 @@ pub async fn run( ps: &ProcState, worker: MainWorker, maybe_eval: Option, -) -> Result<(), AnyError> { +) -> Result { let mut repl_session = ReplSession::initialize(worker).await?; let mut rustyline_channel = rustyline_channel(); @@ -807,5 +807,5 @@ pub async fn run( editor.save_history()?; - Ok(()) + Ok(repl_session.worker.get_exit_code()) } -- cgit v1.2.3