File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -142,11 +142,15 @@ fn diff(opt: DiffOpt) -> Result<(), Box<dyn Error + Send + Sync>> {
142142
143143 table. printstd ( ) ;
144144
145- _ = writeln ! (
145+ let res = writeln ! (
146146 std:: io:: stdout( ) ,
147147 "Total cpu time: {:?}" ,
148148 results. total_time
149149 ) ;
150+ if res. is_err ( ) {
151+ // there's something wrong with stdout - give up on writing more
152+ std:: process:: exit ( 1 ) ;
153+ }
150154
151155 let mut table = Table :: new ( ) ;
152156
@@ -290,18 +294,26 @@ fn summarize(opt: SummarizeOpt) -> Result<(), Box<dyn Error + Send + Sync>> {
290294
291295 table. printstd ( ) ;
292296
293- _ = writeln ! (
297+ let res = writeln ! (
294298 std:: io:: stdout( ) ,
295299 "Total cpu time: {:?}" ,
296300 results. total_time
297301 ) ;
302+ if res. is_err ( ) {
303+ // there's something wrong with stdout - give up on writing more
304+ std:: process:: exit ( 1 ) ;
305+ }
298306
299307 if percent_above != 0.0 {
300- _ = writeln ! (
308+ let res = writeln ! (
301309 std:: io:: stdout( ) ,
302310 "Filtered results account for {:.3}% of total time." ,
303311 percent_total_time
304312 ) ;
313+ if res. is_err ( ) {
314+ // there's something wrong with stdout - give up on writing more
315+ std:: process:: exit ( 1 ) ;
316+ }
305317 }
306318
307319 let mut table = Table :: new ( ) ;
You can’t perform that action at this time.
0 commit comments