Skip to content

Commit 77ccc1e

Browse files
authoredJun 26, 2022
Fix preserving stdin's pause state (#210)
1 parent c2400db commit 77ccc1e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎utilities.js

+10
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,17 @@ export class StdinDiscarder {
7979
return;
8080
}
8181

82+
const {stdin} = process;
83+
const wasPaused = stdin.isPaused();
84+
8285
this.#rl.close();
86+
87+
// Keep stdin unpaused across the readline close if it is already
88+
// unpaused. See #209 for more details.
89+
if (!wasPaused && stdin.isPaused()) {
90+
stdin.resume();
91+
}
92+
8393
this.#rl = undefined;
8494
}
8595
}

0 commit comments

Comments
 (0)