np
np copied to clipboard
Ctrl+C during np cli exits with status 0
Description
Steps to reproduce
-
git clone [email protected]:oren-l/np-issue.git
-
npm install
-
npm run release
- Type <Ctrl+C> when prompted for selecting semver change
Expected behavior
Aborting np should exit with non-zero status code so that any post-hooks will not be executed.
Environment
np - 6.2.1 Node.js - 11.15.0 npm - 6.14.4 Git - 2.20.1 (Apple Git-117) OS - macOS Mojave 10.14.6
This only happens for me on my mac, in a windows machine I was not able to reproduce it.
So, on further investigation, this appears to be a known issue with inquirer catching the SIGINT.
The same issue also has a quick-fix for this, using a SignalRef
and this works in our code as well, as seen here. I tried the solution quickly and it looks like it works.
The only part I don't like is that it makes the simple inquirer
prompt action look fairly more complicated as we have to wrap it around the above function.
@sindresorhus , do you think it's worth us doing a fix on this or should we wait for inquirer to handle this gracefully?
I'd prefer to wait for Inquirer to handle it. It's not a big issue, but the boilerplate would be annoying.