@@ -251,13 +251,15 @@ fn check_binary_runs(command: &[&str], override_path: Option<String>) -> anyhow:
251
251
output. arg ( arg) ;
252
252
}
253
253
254
+ let command_invocation = get_command_invocation_string ( & output) ;
255
+
254
256
if let Some ( path) = override_path {
255
257
output. env ( "PATH" , path) ;
256
258
}
257
259
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
+ ) ) ?;
261
263
262
264
if !output. status . success ( ) {
263
265
return Err ( anyhow ! (
@@ -283,14 +285,10 @@ fn check_perf_runs(perf_binary_path: &str, run_with_sudo: bool) -> anyhow::Resul
283
285
284
286
/// Returns the command invocation string for a given
285
287
/// [`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 ( ) {
294
292
command_str. push ( ' ' ) ;
295
293
command_str. push_str ( & arg. to_string_lossy ( ) ) ;
296
294
}
@@ -425,7 +423,7 @@ async fn profile_with_bcc_profile(
425
423
. env_clear ( )
426
424
. env ( "PATH" , path) ;
427
425
428
- let command_str = get_command_invocation_string ( & command) ;
426
+ let command_str = get_command_invocation_string ( command. as_std ( ) ) ;
429
427
430
428
let result = command. output ( ) ;
431
429
0 commit comments