File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -105,12 +105,19 @@ impl<'a> Renderer<'a> {
105
105
break ;
106
106
}
107
107
108
- self . render_message ( match serde_json:: from_str ( & line) {
109
- Ok ( parsed) => parsed,
110
- Err ( err) => {
111
- panic ! ( "failed to parse libtest json output; error: {err}, line: {line:?}" ) ;
112
- }
113
- } ) ;
108
+ let trimmed = line. trim ( ) ;
109
+ if trimmed. starts_with ( "{" ) && trimmed. ends_with ( "}" ) {
110
+ self . render_message ( match serde_json:: from_str ( & trimmed) {
111
+ Ok ( parsed) => parsed,
112
+ Err ( err) => {
113
+ panic ! ( "failed to parse libtest json output; error: {err}, line: {line:?}" ) ;
114
+ }
115
+ } ) ;
116
+ } else {
117
+ // Handle non-JSON output, for example when --nocapture is passed.
118
+ print ! ( "{line}" ) ;
119
+ let _ = std:: io:: stdout ( ) . flush ( ) ;
120
+ }
114
121
}
115
122
}
116
123
You can’t perform that action at this time.
0 commit comments