Also print extra env variables as cmd_str

This commit is contained in:
datdenkikniet 2023-04-16 13:27:46 +02:00
parent bc92e43b11
commit 319c2263f3

View file

@ -355,6 +355,12 @@ impl core::fmt::Display for CargoCommand<'_> {
impl<'a> CargoCommand<'a> { impl<'a> CargoCommand<'a> {
pub fn as_cmd_string(&self) -> String { pub fn as_cmd_string(&self) -> String {
let env = if let Some((key, value)) = self.extra_env() {
format!("{key}=\"{value}\" ")
} else {
format!("")
};
let cd = if let Some(Some(chdir)) = self.chdir().map(|p| p.to_str()) { let cd = if let Some(Some(chdir)) = self.chdir().map(|p| p.to_str()) {
format!("cd {chdir} && ") format!("cd {chdir} && ")
} else { } else {
@ -363,7 +369,7 @@ impl<'a> CargoCommand<'a> {
let executable = self.executable(); let executable = self.executable();
let args = self.args().join(" "); let args = self.args().join(" ");
format!("{cd}{executable} {args}") format!("{env}{cd}{executable} {args}")
} }
fn command(&self) -> &'static str { fn command(&self) -> &'static str {