Skip to content

Commit fa5ff86

Browse files
committed
Auto merge of #17697 - Veykril:cargo-env, r=Veykril
fix: Support new cargo config get env format Fixes #17686
2 parents cddce62 + c7d6fe5 commit fa5ff86

File tree

1 file changed

+14
-2
lines changed
  • crates/project-model/src

1 file changed

+14
-2
lines changed

crates/project-model/src/env.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,26 @@ pub(crate) fn cargo_config_env(
7575
}
7676
// if successful we receive `env.key.value = "value" per entry
7777
tracing::debug!("Discovering cargo config env by {:?}", cargo_config);
78-
utf8_stdout(cargo_config).map(parse_output_cargo_config_env).unwrap_or_default()
78+
utf8_stdout(cargo_config)
79+
.map(parse_output_cargo_config_env)
80+
.inspect(|env| {
81+
tracing::debug!("Discovered cargo config env: {:?}", env);
82+
})
83+
.inspect_err(|err| {
84+
tracing::error!("Failed to discover cargo config env: {:?}", err);
85+
})
86+
.unwrap_or_default()
7987
}
8088

8189
fn parse_output_cargo_config_env(stdout: String) -> FxHashMap<String, String> {
8290
stdout
8391
.lines()
8492
.filter_map(|l| l.strip_prefix("env."))
85-
.filter_map(|l| l.split_once(".value = "))
93+
.filter_map(|l| {
94+
l.split_once(" = ")
95+
// cargo used to report it with this, keep it for a couple releases around
96+
.or_else(|| l.split_once(".value = "))
97+
})
8698
.map(|(key, value)| (key.to_owned(), value.trim_matches('"').to_owned()))
8799
.collect()
88100
}

0 commit comments

Comments
 (0)