@@ -24,9 +24,9 @@ use tokio::{
24
24
io:: { AsyncBufReadExt , BufReader } ,
25
25
process:: Command as AsyncCommand ,
26
26
runtime:: Runtime ,
27
- stream:: StreamExt ,
28
27
time,
29
28
} ;
29
+ use tokio_stream:: { wrappers:: LinesStream , StreamExt } ;
30
30
31
31
lazy_static:: lazy_static! {
32
32
// TODO: Migrate to asynchronous code and remove runtime
@@ -480,7 +480,6 @@ impl<'w, 'pl> Command<'w, 'pl> {
480
480
}
481
481
482
482
let out = RUNTIME
483
- . handle ( )
484
483
. block_on ( log_command (
485
484
cmd,
486
485
self . process_lines ,
@@ -574,13 +573,11 @@ async fn log_command(
574
573
} ;
575
574
576
575
let mut child = cmd. stdout ( Stdio :: piped ( ) ) . stderr ( Stdio :: piped ( ) ) . spawn ( ) ?;
577
- let child_id = child. id ( ) ;
576
+ let child_id = child. id ( ) . unwrap ( ) ;
578
577
579
- let stdout = BufReader :: new ( child. stdout . take ( ) . unwrap ( ) )
580
- . lines ( )
578
+ let stdout = LinesStream :: new ( BufReader :: new ( child. stdout . take ( ) . unwrap ( ) ) . lines ( ) )
581
579
. map ( |line| ( OutputKind :: Stdout , line) ) ;
582
- let stderr = BufReader :: new ( child. stderr . take ( ) . unwrap ( ) )
583
- . lines ( )
580
+ let stderr = LinesStream :: new ( BufReader :: new ( child. stderr . take ( ) . unwrap ( ) ) . lines ( ) )
584
581
. map ( |line| ( OutputKind :: Stderr , line) ) ;
585
582
586
583
let start = Instant :: now ( ) ;
@@ -642,7 +639,7 @@ async fn log_command(
642
639
} ,
643
640
) ;
644
641
645
- let child = time:: timeout ( timeout, child) . map ( move |result| {
642
+ let child = time:: timeout ( timeout, child. wait ( ) ) . map ( move |result| {
646
643
match result {
647
644
// If the timeout elapses, kill the process
648
645
Err ( _timeout) => Err ( match native:: kill_process ( child_id) {
0 commit comments