@ -5716,27 +5716,24 @@ async fn shell_impl_async(
process . wait_with_output ( ) . await ?
process . wait_with_output ( ) . await ?
} ;
} ;
if ! output . status . success ( ) {
let output = if ! output . status . success ( ) {
if ! output . stderr . is_empty ( ) {
if output . stderr . is_empty ( ) {
let err = String ::from_utf8_lossy ( & output . stderr ) . to_string ( ) ;
match output . status . code ( ) {
log ::error ! ( "Shell error: {}" , err ) ;
Some ( exit_code ) = > bail ! ( "Shell command failed: status {}" , exit_code ) ,
bail ! ( "Shell error: {}" , err ) ;
None = > bail ! ( "Shell command failed" ) ,
}
}
match output . status . code ( ) {
Some ( exit_code ) = > bail ! ( "Shell command failed: status {}" , exit_code ) ,
None = > bail ! ( "Shell command failed" ) ,
}
}
String ::from_utf8_lossy ( & output . stderr )
// Prioritize `stderr` output over `stdout`
} else if ! output . stderr . is_empty ( ) {
} else if ! output . stderr . is_empty ( ) {
log ::debug ! (
let stderr = String ::from_utf8_lossy ( & output . stderr ) ;
"Command printed to stderr: {}" ,
log ::debug ! ( "Command printed to stderr: {stderr}" ) ;
String ::from_utf8_lossy ( & output . stderr ) . to_string ( )
stderr
) ;
} else {
}
String ::from_utf8_lossy ( & output . stdout )
} ;
let str = std ::str ::from_utf8 ( & output . stdout )
Ok ( Tendril ::from ( output ) )
. map_err ( | _ | anyhow ! ( "Process did not output valid UTF-8" ) ) ? ;
let tendril = Tendril ::from ( str ) ;
Ok ( tendril )
}
}
fn shell ( cx : & mut compositor ::Context , cmd : & str , behavior : & ShellBehavior ) {
fn shell ( cx : & mut compositor ::Context , cmd : & str , behavior : & ShellBehavior ) {