Skip to content

Commit eb61ba4

Browse files
committed
add short cmd to command fingerprint and remove FormatShortCommand from tracing
1 parent 1c61935 commit eb61ba4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/bootstrap/src/utils/exec.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ pub struct CommandFingerprint {
7474
args: Vec<OsString>,
7575
envs: Vec<(OsString, Option<OsString>)>,
7676
cwd: Option<PathBuf>,
77+
short_cmd: String,
7778
}
7879

7980
#[derive(Default, Clone)]
@@ -118,7 +119,7 @@ impl CommandProfiler {
118119
let stats = self.stats.lock().unwrap();
119120

120121
for (key, profile) in stats.iter() {
121-
writeln!(writer, "Command: {:?}", key.program).unwrap();
122+
writeln!(writer, "Command: {:?}", key.short_cmd).unwrap();
122123

123124
let mut hits = 0;
124125
let mut runs = 0;
@@ -350,6 +351,7 @@ impl<'a> BootstrapCommand {
350351
.map(|(k, v)| (k.to_os_string(), v.map(|val| val.to_os_string())))
351352
.collect(),
352353
cwd: command.get_current_dir().map(Path::to_path_buf),
354+
short_cmd: command.format_short_cmd(),
353355
}
354356
}
355357
}
@@ -495,19 +497,16 @@ impl Default for CommandOutput {
495497

496498
/// Helper trait to format both Command and BootstrapCommand as a short execution line,
497499
/// without all the other details (e.g. environment variables).
498-
#[cfg(feature = "tracing")]
499500
pub trait FormatShortCmd {
500501
fn format_short_cmd(&self) -> String;
501502
}
502503

503-
#[cfg(feature = "tracing")]
504504
impl FormatShortCmd for BootstrapCommand {
505505
fn format_short_cmd(&self) -> String {
506506
self.command.format_short_cmd()
507507
}
508508
}
509509

510-
#[cfg(feature = "tracing")]
511510
impl FormatShortCmd for Command {
512511
fn format_short_cmd(&self) -> String {
513512
let program = Path::new(self.get_program());

0 commit comments

Comments
 (0)