File tree Expand file tree Collapse file tree
src/cortex-engine/src/unified_exec Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -142,6 +142,12 @@ impl fmt::Display for ExecError {
142142 write ! ( f, " (exit code: {code})" ) ?;
143143 }
144144
145+ if let Some ( ref stderr) = self . stderr {
146+ if !stderr. is_empty ( ) {
147+ write ! ( f, " (stderr: {stderr})" ) ?;
148+ }
149+ }
150+
145151 Ok ( ( ) )
146152 }
147153}
@@ -232,6 +238,22 @@ mod tests {
232238 assert ! ( display. contains( "timed out" ) ) ;
233239 }
234240
241+ #[ test]
242+ fn test_error_display_includes_stderr ( ) {
243+ let err = ExecError :: exit ( "bash -c 'exit 1'" , 1 , Some ( "error-detail" . to_string ( ) ) ) ;
244+ let display = format ! ( "{}" , err) ;
245+
246+ assert ! ( display. contains( "stderr: error-detail" ) ) ;
247+ }
248+
249+ #[ test]
250+ fn test_error_display_omits_empty_stderr ( ) {
251+ let err = ExecError :: exit ( "bash -c 'exit 1'" , 1 , Some ( String :: new ( ) ) ) ;
252+ let display = format ! ( "{}" , err) ;
253+
254+ assert ! ( !display. contains( "stderr:" ) ) ;
255+ }
256+
235257 #[ test]
236258 fn test_retriable ( ) {
237259 assert ! ( ExecError :: timeout( "cmd" , 10 ) . is_retriable( ) ) ;
You can’t perform that action at this time.
0 commit comments