From 319c2263f3cebd5d990ba5fee277ec9cf1b1d2f9 Mon Sep 17 00:00:00 2001 From: datdenkikniet Date: Sun, 16 Apr 2023 13:27:46 +0200 Subject: [PATCH] Also print extra env variables as cmd_str --- xtask/src/cargo_command.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xtask/src/cargo_command.rs b/xtask/src/cargo_command.rs index b0102ce3c1..401bab4c41 100644 --- a/xtask/src/cargo_command.rs +++ b/xtask/src/cargo_command.rs @@ -355,6 +355,12 @@ impl core::fmt::Display for CargoCommand<'_> { impl<'a> CargoCommand<'a> { 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()) { format!("cd {chdir} && ") } else { @@ -363,7 +369,7 @@ impl<'a> CargoCommand<'a> { let executable = self.executable(); let args = self.args().join(" "); - format!("{cd}{executable} {args}") + format!("{env}{cd}{executable} {args}") } fn command(&self) -> &'static str {