From d735324df01596481a7a7ce682d23c1e5f3a2cf8 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Tue, 3 Oct 2023 11:46:20 -0300 Subject: [PATCH] fix(cli): deadlock regression from #7802 (#7948) --- tooling/cli/Cargo.lock | 5 +++-- tooling/cli/src/helpers/config.rs | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tooling/cli/Cargo.lock b/tooling/cli/Cargo.lock index 337d3dac3064..c01c0396f81d 100644 --- a/tooling/cli/Cargo.lock +++ b/tooling/cli/Cargo.lock @@ -2142,9 +2142,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" dependencies = [ "value-bag", ] @@ -4112,6 +4112,7 @@ dependencies = [ "json-patch", "json5", "kuchikiki", + "log", "memchr", "phf 0.10.1", "schemars", diff --git a/tooling/cli/src/helpers/config.rs b/tooling/cli/src/helpers/config.rs index 9b251bb29cef..bbf1f5129f0b 100644 --- a/tooling/cli/src/helpers/config.rs +++ b/tooling/cli/src/helpers/config.rs @@ -205,8 +205,13 @@ pub fn get(target: Target, merge_config: Option<&str>) -> crate::Result) -> crate::Result { - if let Some(conf) = &*config_handle().lock().unwrap() { - get_internal(merge_config, true, conf.target) + let target = config_handle() + .lock() + .unwrap() + .as_ref() + .map(|conf| conf.target); + if let Some(target) = target { + get_internal(merge_config, true, target) } else { Err(anyhow::anyhow!("config not loaded")) }