Skip to content

Commit 47a7048

Browse files
committed
Debug sudo in CI
1 parent 148f84d commit 47a7048

File tree

1 file changed

+10
-12
lines changed
  • compute_tools/src/profiling

1 file changed

+10
-12
lines changed

compute_tools/src/profiling/mod.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,15 @@ fn check_binary_runs(command: &[&str], override_path: Option<String>) -> anyhow:
251251
output.arg(arg);
252252
}
253253

254+
let command_invocation = get_command_invocation_string(&output);
255+
254256
if let Some(path) = override_path {
255257
output.env("PATH", path);
256258
}
257259

258-
let output = output
259-
.output()
260-
.context("failed to run the command to check if it can be run")?;
260+
let output = output.output().context(format!(
261+
"failed to run the command to check if it can be run: {command_invocation}"
262+
))?;
261263

262264
if !output.status.success() {
263265
return Err(anyhow!(
@@ -283,14 +285,10 @@ fn check_perf_runs(perf_binary_path: &str, run_with_sudo: bool) -> anyhow::Resul
283285

284286
/// Returns the command invocation string for a given
285287
/// [`tokio::process::Command`].
286-
fn get_command_invocation_string(command: &tokio::process::Command) -> String {
287-
let mut command_str = command
288-
.as_std()
289-
.get_program()
290-
.to_string_lossy()
291-
.into_owned();
292-
293-
for arg in command.as_std().get_args() {
288+
fn get_command_invocation_string(command: &std::process::Command) -> String {
289+
let mut command_str = command.get_program().to_string_lossy().into_owned();
290+
291+
for arg in command.get_args() {
294292
command_str.push(' ');
295293
command_str.push_str(&arg.to_string_lossy());
296294
}
@@ -425,7 +423,7 @@ async fn profile_with_bcc_profile(
425423
.env_clear()
426424
.env("PATH", path);
427425

428-
let command_str = get_command_invocation_string(&command);
426+
let command_str = get_command_invocation_string(command.as_std());
429427

430428
let result = command.output();
431429

0 commit comments

Comments
 (0)