File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -557,18 +557,27 @@ fn wait_for_port(port: u16) -> Option<()> {
557557/// on a given `Child`, this must not read bytes from its `stdout`
558558/// that appear after `expected`.
559559fn wait_for_stdout ( stream : & mut Child , expected : & [ u8 ] ) {
560- let stdout = stream. stdout . as_mut ( ) . unwrap ( ) ;
561-
562- let mut buffer = Vec :: with_capacity ( 1024 ) ;
560+ let mut buffer = Vec :: with_capacity ( 128 ) ;
563561
564562 loop {
565563 let mut input = [ 0u8 ] ;
566- let new = stdout. read ( & mut input) . unwrap ( ) ;
567- assert_eq ! ( new, 1 ) ;
564+ let new = stream . stdout . as_mut ( ) . unwrap ( ) . read ( & mut input) . unwrap ( ) ;
565+ assert_eq ! ( new, 1 , "stdout EOF -- read so far {buffer:?}" ) ;
568566 buffer. push ( input[ 0 ] ) ;
569567
570568 if buffer. ends_with ( expected) {
571569 return ;
572570 }
571+
572+ assert ! (
573+ buffer. len( ) < 128 ,
574+ "{expected:?} did not appear in first part of {stream:?} (instead it was {buffer:?}"
575+ ) ;
576+
577+ match stream. try_wait ( ) {
578+ Ok ( Some ( status) ) => panic ! ( "process exited already with {status}" ) ,
579+ Ok ( None ) => { }
580+ Err ( e) => panic ! ( "subprocess broken {e:?}" ) ,
581+ } ;
573582 }
574583}
You can’t perform that action at this time.
0 commit comments