@@ -123,11 +123,9 @@ function runAuthScript(
123
123
} ) ;
124
124
125
125
let pendingStdout = '' ;
126
- let flushNotYetTerminatedLineTimeout = null ;
126
+ proc . stdout . setEncoding ( 'utf8' ) ;
127
127
proc . stdout . on ( 'data' , ( chunk ) => {
128
128
pendingStdout += chunk ;
129
- clearTimeout ( flushNotYetTerminatedLineTimeout ) ;
130
- flushNotYetTerminatedLineTimeout = null ;
131
129
132
130
try {
133
131
let newlineIndex ;
@@ -137,13 +135,6 @@ function runAuthScript(
137
135
138
136
onLine ( line ) ;
139
137
}
140
-
141
- if ( pendingStdout . length > 0 ) {
142
- flushNotYetTerminatedLineTimeout = setTimeout ( ( ) => {
143
- onLine ( pendingStdout ) ;
144
- pendingStdout = '' ;
145
- } , 100 ) ;
146
- }
147
138
} catch ( err ) {
148
139
proc . kill ( ) ;
149
140
reject ( err ) ;
@@ -155,19 +146,9 @@ function runAuthScript(
155
146
expect . length ,
156
147
0 ,
157
148
`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 ( ) } $` ) ;
166
150
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 ) ;
171
152
if ( expect . length === 0 ) {
172
153
proc . stdin . end ( ) ;
173
154
}
0 commit comments