Skip to content

Commit

Permalink
Fix preserving stdin's pause state (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
clavin committed Jun 26, 2022
1 parent c2400db commit 77ccc1e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions utilities.js
Expand Up @@ -79,7 +79,17 @@ export class StdinDiscarder {
return;
}

const {stdin} = process;
const wasPaused = stdin.isPaused();

this.#rl.close();

// Keep stdin unpaused across the readline close if it is already
// unpaused. See #209 for more details.
if (!wasPaused && stdin.isPaused()) {
stdin.resume();
}

this.#rl = undefined;
}
}

0 comments on commit 77ccc1e

Please sign in to comment.