File tree Expand file tree Collapse file tree 2 files changed +13
-21
lines changed
antlir/antlir2/antlir2_vm/src Expand file tree Collapse file tree 2 files changed +13
-21
lines changed Original file line number Diff line number Diff line change @@ -38,23 +38,21 @@ pub(crate) fn log_command(command: &mut Command) -> &mut Command {
3838/// finish fast.
3939pub ( crate ) fn run_command_capture_output ( command : & mut Command ) -> Result < ( ) , std:: io:: Error > {
4040 let output = log_command ( command) . output ( ) ?;
41- let stdout = String :: from_utf8 ( output. stdout ) . map_err ( |e| {
42- std:: io:: Error :: new ( ErrorKind :: Other , format ! ( "Failed to decode stdout: {e}" ) )
43- } ) ?;
44- let stderr = String :: from_utf8 ( output. stderr ) . map_err ( |e| {
45- std:: io:: Error :: new ( ErrorKind :: Other , format ! ( "Failed to decode stderr: {e}" ) )
46- } ) ?;
41+ let stdout = String :: from_utf8 ( output. stdout )
42+ . map_err ( |e| std:: io:: Error :: other ( format ! ( "Failed to decode stdout: {e}" ) ) ) ?;
43+ let stderr = String :: from_utf8 ( output. stderr )
44+ . map_err ( |e| std:: io:: Error :: other ( format ! ( "Failed to decode stderr: {e}" ) ) ) ?;
4745 if !output. status . success ( ) {
4846 error ! (
4947 "Command {} failed\n Stdout: {}\n Stderr: {}" ,
5048 command. get_program( ) . to_string_lossy( ) ,
5149 stdout,
5250 stderr
5351 ) ;
54- return Err ( std:: io:: Error :: new (
55- ErrorKind :: Other ,
56- format ! ( "Failed to execute command: {:?}" , command ) ,
57- ) ) ;
52+ return Err ( std:: io:: Error :: other ( format ! (
53+ "Failed to execute command: {:?}" ,
54+ command
55+ ) ) ) ;
5856 }
5957 if !stdout. is_empty ( ) {
6058 debug ! ( stdout) ;
Original file line number Diff line number Diff line change @@ -351,19 +351,13 @@ impl<S: Share> VM<S> {
351351 let msg = format ! ( "Sidecar service at index {} finished unexpectedly" , i) ;
352352 error ! ( "{}" , & msg) ;
353353 let status = x. join ( ) . map_err ( |e| {
354- VMError :: SidecarError ( std:: io:: Error :: new (
355- ErrorKind :: Other ,
356- format ! (
357- "Failed to join thread for sidecar service at index {}: {:?}" ,
358- i, e
359- ) ,
360- ) )
354+ VMError :: SidecarError ( std:: io:: Error :: other ( format ! (
355+ "Failed to join thread for sidecar service at index {}: {:?}" ,
356+ i, e
357+ ) ) )
361358 } ) ?;
362359 error ! ( "Exit status {:#?}" , status) ;
363- return Err ( VMError :: SidecarError ( std:: io:: Error :: new (
364- ErrorKind :: Other ,
365- msg,
366- ) ) ) ;
360+ return Err ( VMError :: SidecarError ( std:: io:: Error :: other ( msg) ) ) ;
367361 }
368362 Ok ( ( ) )
369363 } )
You can’t perform that action at this time.
0 commit comments