Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexitable when run in loop #28

Closed
maxp-edcast opened this issue Dec 10, 2017 · 1 comment
Closed

unexitable when run in loop #28

maxp-edcast opened this issue Dec 10, 2017 · 1 comment

Comments

@maxp-edcast
Copy link

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant