fix(cli): deadlock regression from #7802 (#7948)

This commit is contained in:
Lucas Fernandes Nogueira 2023-10-03 11:46:20 -03:00 committed by GitHub
parent b597aa5f39
commit d735324df0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -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",

View File

@ -205,8 +205,13 @@ pub fn get(target: Target, merge_config: Option<&str>) -> crate::Result<ConfigHa
}
pub fn reload(merge_config: Option<&str>) -> crate::Result<ConfigHandle> {
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"))
}