-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
SIGINT not triggering with readline #4758
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Hi @felipenmoura. Thanks for the report. Could you possibly give us a reduced test case with no external dependencies that shows this behavior so we can reproduce? Thanks! |
@felipenmoura If you are trying to trigger by |
Yep. By the way, a test case: process.on('SIGINT', function(){
console.log('oh, you triggered it!');
});
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question('What do you think of Node.js? ', (answer) => {
console.log('Thank you for your valuable feedback, which was:\n', answer);
rl.close();
}); |
So, readline is actually handles it, but only if it thinks it's input is a TTY: https://github.com/nodejs/node/blob/master/lib/readline.js#L693-L701 |
Adding the |
This looks to have been solved for some time now so I'll go ahead and close the issue. Holler if it should be reopened. |
Previous readline would catch cntl-c the first time it was pressed. Refs: nodejs/node#4758
When using readline, the
process.on('SIGINT', ...)
is never triggered.Is that planned, or perhaps a bug?
I searched and did not find other issues about it.
The text was updated successfully, but these errors were encountered: