@@ -123,11 +123,9 @@ function runAuthScript(
123123 } ) ;
124124
125125 let pendingStdout = '' ;
126- let flushNotYetTerminatedLineTimeout = null ;
126+ proc . stdout . setEncoding ( 'utf8' ) ;
127127 proc . stdout . on ( 'data' , ( chunk ) => {
128128 pendingStdout += chunk ;
129- clearTimeout ( flushNotYetTerminatedLineTimeout ) ;
130- flushNotYetTerminatedLineTimeout = null ;
131129
132130 try {
133131 let newlineIndex ;
@@ -137,13 +135,6 @@ function runAuthScript(
137135
138136 onLine ( line ) ;
139137 }
140-
141- if ( pendingStdout . length > 0 ) {
142- flushNotYetTerminatedLineTimeout = setTimeout ( ( ) => {
143- onLine ( pendingStdout ) ;
144- pendingStdout = '' ;
145- } , 100 ) ;
146- }
147138 } catch ( err ) {
148139 proc . kill ( ) ;
149140 reject ( err ) ;
@@ -155,19 +146,9 @@ function runAuthScript(
155146 expect . length ,
156147 0 ,
157148 `unexpected stdout line: ${ line } ` ) ;
158- let expected = expect . shift ( ) ;
159- let reply ;
160- if ( typeof expected . reply === 'string' ) {
161- ( { expected, reply } = expected ) ;
162- }
163- if ( typeof expected === 'string' ) {
164- expected = new RegExp ( `^${ expected } $` ) ;
165- }
149+ const expected = new RegExp ( `^${ expect . shift ( ) } $` ) ;
166150
167- assert ( line . match ( expected ) , `${ line } should match ${ expected } ` ) ;
168- if ( reply !== undefined ) {
169- proc . stdin . write ( `${ reply } \n` ) ;
170- }
151+ assert . match ( line , expected ) ;
171152 if ( expect . length === 0 ) {
172153 proc . stdin . end ( ) ;
173154 }
0 commit comments