Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Allow user to kill process during call to keyInYN/keyInYNStrict #42

Closed
trevorhreed opened this issue Jul 5, 2016 · 3 comments
Closed

Comments

@trevorhreed
Copy link

I am unable to kill the process (by pressing Ctrl+C or Ctrl+Z) when inside a call to either keyInYN or keyInYNStrict. Regular question calls work as expected, but I would think you would also want to let the user kill the process even in a call to keyInYNStrict. Or perhaps, this could be an option at least?

@anseki
Copy link
Owner

anseki commented Jul 6, 2016

Hi @trevorhreed, thank you for the report.

If you are using Windows, try Break key (Ctrl+Pause-Break).

This may help you: #7

Node.js seems to do different behavior about handling SIGINT while TTY in raw mode, in some environments, shells, versions, etc.
It has been discussed at times (e.g. nodejs/node#4758, nodejs/node#3328, nodejs/node#6626).
Someday, Node.js might solve this problem.

Now, better way I think is giving the choice to cancel to user without ^C.
For example, additional keyInYN method (instead of keyInPause) allow user to make the final decision on whether something should do or not, after inputting all information.

@trevorhreed
Copy link
Author

That's too bad. I will add a confirmation screen at the end to work around this. Really great library, by the way! Thanks!

@anseki
Copy link
Owner

anseki commented Jul 6, 2016

😃

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

No branches or pull requests

2 participants