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

Ctrl+C during np cli exits with status 0 #528

Closed
oren-l opened this issue Apr 21, 2020 · 3 comments
Closed

Ctrl+C during np cli exits with status 0 #528

oren-l opened this issue Apr 21, 2020 · 3 comments

Comments

@oren-l
Copy link

oren-l commented Apr 21, 2020

Description

issue demo

Steps to reproduce

  1. git clone git@github.com:oren-l/np-issue.git
  2. npm install
  3. npm run release
  4. 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

@oren-l
Copy link
Author

oren-l commented Apr 21, 2020

This only happens for me on my mac, in a windows machine I was not able to reproduce it.

@dopecodez dopecodez added the bug label Jun 30, 2020
@dopecodez
Copy link
Collaborator

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?

@sindresorhus
Copy link
Owner

I'd prefer to wait for Inquirer to handle it. It's not a big issue, but the boilerplate would be annoying.

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

No branches or pull requests

4 participants