unexitable when run in loop
maxp-edcast opened this issue · 1 comments
maxp-edcast commented
I have the following simple coffeescript file:
# test.coffee
ps = require("prompt-sync")()
out = NaN
while isNaN out
out = parseInt ps("enter input")
When I run this using coffee test.coffee
and instead of entering text try exiting with control+c, it does not exit but just goes to the next tick of the while
loop. When I enter "1", it exits as expected.
There's also the same behavior in Javascript. Here is the same script compiled to JS:
// test.js
// Generated by CoffeeScript 2.0.3
(function() {
var out, ps;
ps = require("prompt-sync")();
out = 0/0;
while (isNaN(out)) {
out = parseInt(ps("enter input"));
}
}).call(this);
When running this with node test.js
, the same behavior occurs.
Is this expected, or should we be manually handling control+c?
- prompt sync version '4.1.5'
- coffee version 2.0.3
- node version 9.0.0
maxp-edcast commented
Sorry, I didnt read the readme ... the note on sigint is there. I wonder if sigint should default to true, I don't see the benefit in having false be the default, and it made me have to kill -9 the process.