diff options
| author | datdenkikniet <jcdra1@gmail.com> | 2023-04-15 12:21:11 +0200 |
|---|---|---|
| committer | datdenkikniet <jcdra1@gmail.com> | 2023-04-15 12:33:46 +0200 |
| commit | 525703358bf52b74a01d9b0c04680d33621d60cd (patch) | |
| tree | 366346833e91ebfc1704525233cfb68abe3ef600 /xtask/src/command.rs | |
| parent | 1ccca03a70b5d11dc03c046041138f73267af22a (diff) | |
Rework command execution structure and make rayon optional (since it's not necessarily faster
due to workspace wide lockfile contention)
Diffstat (limited to 'xtask/src/command.rs')
| -rw-r--r-- | xtask/src/command.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/xtask/src/command.rs b/xtask/src/command.rs index 32ca9c8..359a7f9 100644 --- a/xtask/src/command.rs +++ b/xtask/src/command.rs @@ -108,6 +108,14 @@ pub enum CargoCommand<'a> { }, } +impl core::fmt::Display for CargoCommand<'_> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let executable = self.executable(); + let args = self.args().join(" "); + write!(f, "\"{executable} {args}\"") + } +} + impl<'a> CargoCommand<'a> { fn command(&self) -> &str { match self { @@ -460,12 +468,7 @@ impl fmt::Display for BuildMode { } pub fn run_command(command: &CargoCommand, stderr_mode: OutputMode) -> anyhow::Result<RunResult> { - let command_display = command.executable(); - let args = command.args(); - - let full_command = format!("\"{command_display}\" {}", args.join(" ")); - - debug!("👟 {full_command}"); + debug!("👟 {command}"); let result = Command::new(command.executable()) .args(command.args()) @@ -479,7 +482,6 @@ pub fn run_command(command: &CargoCommand, stderr_mode: OutputMode) -> anyhow::R Ok(RunResult { exit_status, - full_command, stdout, stderr, }) |
