File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -226,15 +226,18 @@ export default class ViteShell implements Shell {
226
226
return Promise . reject ( SHELL_INACTIVE ) ;
227
227
}
228
228
229
- // flush the output stream and then activate it
230
- this . #output. reset ( ) ;
231
-
232
229
// incase there's a currently executing command requiring user input
233
230
if ( this . #input. isBusy ) {
234
231
this . #input. insert ( line ) ;
235
232
return Promise . resolve ( ) ;
233
+ } else {
234
+ // otherwise clear the input buffer and any input callback
235
+ this . #input. reset ( ) ;
236
236
}
237
237
238
+ // flush the output stream and then activate it
239
+ this . #output. reset ( ) ;
240
+
238
241
// check if the line contains characters
239
242
if ( typeof line !== "string" || ! line . trim ( ) ) {
240
243
this . #prompt( ) ;
@@ -253,6 +256,7 @@ export default class ViteShell implements Shell {
253
256
254
257
// reset abort token for reuse
255
258
this . #abortSignal. reset ( ) ;
259
+ this . #abortSignal. onAbort ( ( ) => this . #input. reset ( ) ) ;
256
260
257
261
// setup a nodejs-like process object
258
262
const process = createProcessContext (
Original file line number Diff line number Diff line change @@ -41,7 +41,8 @@ export default class InputStream implements StandardInput {
41
41
} ) ;
42
42
}
43
43
44
- public clear ( ) : void {
44
+ public reset ( ) : void {
45
45
this . buffer . splice ( 0 ) ;
46
+ this . extractor = undefined ;
46
47
}
47
48
}
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ describe("Input stream interface", () => {
13
13
expect ( stdin ) . toHaveProperty ( "isBusy" ) ;
14
14
expect ( stdin ) . toHaveProperty ( "insert" ) ;
15
15
expect ( stdin ) . toHaveProperty ( "readline" ) ;
16
- expect ( stdin ) . toHaveProperty ( "clear " ) ;
16
+ expect ( stdin ) . toHaveProperty ( "reset " ) ;
17
17
} ) ;
18
18
19
19
test ( "usage" , ( ) => {
You can’t perform that action at this time.
0 commit comments