@@ -536,23 +536,27 @@ fn log_command(
536
536
return future:: err ( Error :: from ( CommandError :: Timeout ( timeout. as_secs ( ) ) ) ) ;
537
537
}
538
538
539
+ actions. next_input ( & line) ;
540
+ if let Some ( f) = & mut process_lines {
541
+ f ( & line, & mut actions) ;
542
+ }
543
+ let lines = actions. take_lines ( ) ;
544
+
539
545
if log_output {
540
- info ! ( "[{}] {}" , kind. prefix( ) , line) ;
546
+ for line in & lines {
547
+ info ! ( "[{}] {}" , kind. prefix( ) , line) ;
548
+ }
541
549
}
542
- future:: ok ( ( kind, line) )
550
+
551
+ future:: ok ( ( kind, lines) )
543
552
} )
544
553
. fold (
545
554
( Vec :: new ( ) , Vec :: new ( ) ) ,
546
- move |mut res, ( kind, line) | -> Result < _ , Error > {
547
- actions. next_input ( & line) ;
548
-
549
- if let Some ( f) = & mut process_lines {
550
- f ( & line, & mut actions) ;
551
- }
555
+ move |mut res, ( kind, mut lines) | -> Result < _ , Error > {
552
556
if capture {
553
557
match kind {
554
- OutputKind :: Stdout => res. 0 . append ( & mut actions . take_lines ( ) ) ,
555
- OutputKind :: Stderr => res. 1 . append ( & mut actions . take_lines ( ) ) ,
558
+ OutputKind :: Stdout => res. 0 . append ( & mut lines ) ,
559
+ OutputKind :: Stderr => res. 1 . append ( & mut lines ) ,
556
560
}
557
561
}
558
562
Ok ( res)
0 commit comments