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

Nodemon child process not being killed with update to 1.18.0 #1386

Labels
has PR needs more info not enough information in issue to debug

Comments

@nathanchapman
Copy link

  • nodemon -v: 1.18.0
  • node -v: v8.11.2
  • Operating system/terminal environment: macOS 10.13.5/ZSH
  • Command you ran: nodemon --exec npx ...

Expected behaviour

In the previous version (1.17.5), Nodemon would properly kill the child process with ^C

Actual behaviour

After updating to 1.18.0, Nodemon no longer kills the child process and now throws an error:

npm ERR! code ELIFECYCLE
npm ERR! errno 1

Steps to reproduce

Update to 1.18.0 and run a child process like: nodemon --exec npx http-server. Hit control + C. See new error. The http-server will still be running and requires a killall node to exit.


If applicable, please append the --dump flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens.

@remy
Copy link
Owner

remy commented Jul 10, 2018

This is me running that command on my own Mac 10.13.5 using zsh:

screen shot 2018-07-10 at 21 36 43

1.18.0 does change how stdin is handled, so I can believe there's a problem here, but I can't replicate at the moment.

This is a gist of the package.json and I'm able to ctrl-c the process and the sub-process (in my case) does exit.

Are you able to include any more detail on what you're seeing?

@remy remy added the needs more info not enough information in issue to debug label Jul 10, 2018
@remy
Copy link
Owner

remy commented Jul 10, 2018

(I'm shutting down for the night, but if you're able to give me more info I've pushed a version that has a tiny tweak that might help - I'm not sure, you can test from npm i nodemon@debug - it should give you nodemon@1.18.1-alpha.1)

@remy
Copy link
Owner

remy commented Jul 10, 2018

Related commit: a974892

@ianrosedev
Copy link

Mac 10.13.5 using Bash
I'm having the same issue even with nodemon@1.18.1-alpha.1.

screen shot 2018-07-10 at 5 15 40 pm

@virzak
Copy link

virzak commented Jul 10, 2018

Looks like the same issue is happening on Windows. error is the result of pressing ctrl+c. The node task is not killed.

image

@wenbolovesnz
Copy link

I can confirm this is an issue for me as well, I can kill the process on 1.17.5. The issue started appearing after I upgraded to 1.18.0. I am a Mac user.

@remy
Copy link
Owner

remy commented Jul 11, 2018

I've published a new debug version - please can both windows and all other OS types test with this version - again, for myself, both 1.18.0 and debug versions work - but I'm using the exact same example provided by @nathanchapman.

To installed: npm i -g nodemon@debug - should yield nodemon@1.18.1-apha.2

@AllanPooley
Copy link

AllanPooley commented Jul 11, 2018

Also encountered this error today in our dev shop (MacOS).

Temporary fix was to:

  1. Kill process sudo lsof -i tcp:3000 & kill -9 <pid>
    2. Delete node modules rm -rf node_modules
    3. Clear npm cache (npm cache clean --force or yarn cache clean if you're using yarn)
    4. Replace nodemon entry in your npm package-lock.json with entry for 1.17.5 (copy here: https://pastebin.com/S0aC2HWA)
    5. Reinstall node modules (npm install) and run app (npm run dev).
  2. Install 1.17.5 npm install nodemon@1.17.5 --save-dev --save-exact

Will test nodemon@1.18.1-apha.2 in a moment @remy.

@AllanPooley
Copy link

AllanPooley commented Jul 11, 2018

@remy Can confirm nodemon@1.18.1-alpha.2 exits gracefully (without issue error) for me (MacOS)

Before:
image

After:
image

@baileyandy
Copy link

I can also confirm nodemon@1.18.1-alpha.2 on GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17) is working as expected. Thanks for the quick fix!

remy added a commit that referenced this issue Jul 11, 2018
Fixes #1386

Also sends the correct signal codes on exit - so instead of $?=1 on
ctrl-c, you'll see $?=130 as per http://tldp.org/LDP/abs/html/exitcodes.html
@remy remy added the has PR label Jul 11, 2018
@virzak
Copy link

virzak commented Jul 11, 2018

Windows works as well

remy added a commit that referenced this issue Jul 11, 2018
Fixes #1386

Also sends the correct signal codes on exit - so instead of $?=1 on
ctrl-c, you'll see $?=130 as per http://tldp.org/LDP/abs/html/exitcodes.html
@remy
Copy link
Owner

remy commented Jul 11, 2018

Okay, the fix is shipping now. It'll be on npm as 1.18.1 as soon as the tests have finished.

@ianrosedev
Copy link

I'm still getting the error with 1.18.1:

npm ERR! code ELIFECYCLE
npm ERR! errno 130
npm ERR! todo-api@0.1.0 test-watch: `nodemon --exec npm test`
npm ERR! Exit status 130

1.18.1-alpha.2 is working correctly.

@remy
Copy link
Owner

remy commented Jul 11, 2018

@ianrosedev can you explain what you're doing to run that command? i.e. so I can replicate?

@remy
Copy link
Owner

remy commented Jul 11, 2018

Here's what I get when I hit control-c:

screen shot 2018-07-11 at 15 49 12

Left side shows running nodemon (which runs an http server from an npm command) - then on the right side, I curl the server - it responds ok.

I then control-c on the left, then try to curl on the right, and it fails (as the sub-process isn't running anymore).

@ianrosedev
Copy link

@remy I'm running this this Mocha test script:

"test": "export NODE_ENV=test || SET \"NODE_ENV=test\" && mocha -r esm --exit server/**/*.test.js",

@ianrosedev
Copy link

Here's what I get when I hit control-c:

screen shot 2018-07-11 at 10 59 21 am

@virzak
Copy link

virzak commented Jul 11, 2018

I just noticed that on Windows too.

image

Happens with 1.18.1-alpha.2 and 1.18.2

correction
1.18.1-alpha.2 works properly

@remy
Copy link
Owner

remy commented Jul 11, 2018

@ianrosedev did you get your prompt back and did the sub-process end? - so far your screenshots don't answer that question.

@ianrosedev
Copy link

@remy sorry about that. Yes the prompt is coming back and the sub-process is ending.

@remy
Copy link
Owner

remy commented Jul 12, 2018

Please can you try with the current debug version: npm install -g nodemon@debug (1.18.2-alpha.1)

I'm going to revert the change I made for handling ctrl-l if this fixes the issue.

@MateuszJeziorski
Copy link

@remy I had the same issue on Mac with 1.18.1, but it works fine with 1.18.2-alpha.1

@ianrosedev
Copy link

@remy yes 1.18.2-alpha.1 is working correctly for me too.

@nathanchapman
Copy link
Author

nathanchapman commented Jul 12, 2018

1.18.2-alpha.1 works as expected for me as well! Thank you!

remy added a commit that referenced this issue Jul 13, 2018
Fixes #1389
Fixes #1390
Ref #1386

Means that ctrl^l does not instantly clear the terminal. It requires a
new line directly after.
remy added a commit that referenced this issue Jul 13, 2018
Fixes #1389
Fixes #1390
Ref #1386

Means that ctrl^l does not instantly clear the terminal. It requires a
new line directly after.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment