Skip to content

Commit

Permalink
Fix handling of Ctrl+C on spinners beyond first one (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanis Benson authored and sindresorhus committed Sep 29, 2019
1 parent 8779c68 commit 17761e9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.js
Expand Up @@ -221,9 +221,14 @@ class Ora {

stdin.setRawMode(true);
stdin.on('data', noop);
stdin.resume();

const self = this;
stdin.emit = function (event, data, ...args) {
if (event === 'keypress') { // Fixes readline behavior
return;
}

if (event === 'data' && data.includes(ASCII_ETX_CODE)) {
process.emit('SIGINT');
}
Expand Down

0 comments on commit 17761e9

Please sign in to comment.