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

fixes for ctrl-c in 1.18.1 not working when using api #1389

Comments

@dylang
Copy link

dylang commented Jul 11, 2018

  • nodemon -v: 1.18.1
  • node -v: v10.5.0
  • Operating system/terminal environment: macos, zsh 5.5.1
  • Command you ran: node index.js

Expected behaviour

Control-c kills child process and parent process.

Actual behavour

  • Child process is killed.
  • Parent process it not killed.
  • Can't type, hit enter, use arrow keys etc.
  • After manually killing the node process, zsh still doesn't correctly recognize control-c.

Steps to reproduce

const nodemon = require('nodemon');
nodemon({ exec: 'npx', execArgs: [ 'http-server' ] });

node index.js

hit control-c.

Hit CTRL-C to stop the server
http-server stopped.

It says it stopped, but the parent process is never stopped.

Note: npx nodemon --exec npx http-server works fine.


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

@tcrowe
Copy link

tcrowe commented Jul 11, 2018

I was also unable to use Ctrl+c using OSX, iTerm, and Zsh.

I was running it like so: nodemon -L -d 2 -w src -w test --exec 'eslint --fix --cache src test'

@dylang dylang changed the title fixes for ctrl-c in 1.18.1 not working when using nodemon api fixes for ctrl-c in 1.18.1 not working when using api Jul 12, 2018
@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)

@max-degterev
Copy link

max-degterev commented Jul 12, 2018

[14:20:34] Starting 'default'...
Stylusified styles/index.styl in 0.56s
Browserified client/index.es in 1.04s
Browserified client/polyfills.es in 1.47s
[14:20:36] Finished 'default' after 1.59 s
[14:20:36] [nodemon] 1.18.2-alpha.1
[14:20:36] [nodemon] to restart at any time, enter `rs`
[14:20:36] [nodemon] watching: config/**/* server/**/*
[14:20:36] [nodemon] starting `node app.js`
info: Server listening on http://localhost:3000
^C^C^C^C^C^C^C^C^C^C^C

No luck as far as I can tell. Using via gulp-nodemon though. Downgrading to 1.18.0 works as expected throws errors. Downgrading to 1.17.5 works as expected:

[14:38:43] Starting 'default'...
Stylusified styles/index.styl in 0.51s
Browserified client/index.es in 1.11s
Browserified client/polyfills.es in 1.45s
[14:38:44] Finished 'default' after 1.57 s
[14:38:44] [nodemon] 1.17.5
[14:38:44] [nodemon] to restart at any time, enter `rs`
[14:38:44] [nodemon] watching: config/**/* server/**/*
[14:38:44] [nodemon] starting `node app.js`
info: Server listening on http://localhost:3000
^Cinfo: Received SIGINT, shutting down.
info: Closed remaining connections.

@dylang
Copy link
Author

dylang commented Jul 12, 2018

The control characters are printed but the web server doesn't shut down nor the parent process.

Hit CTRL-C to stop the server
^C^C^C^C^C^C^M^M^M^M^C

@remy
Copy link
Owner

remy commented Jul 12, 2018

@dylang and that's using the current debug version of nodemon?

@dylang
Copy link
Author

dylang commented Jul 12, 2018

@remy correct.

 ❯ yarn add nodemon@debug
yarn add v1.7.0
[1/4] 🔍  Resolving packages...
⠁ (node:45784) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ nodemon@1.18.2-alpha.1
info All dependencies
└─ nodemon@1.18.2-alpha.1
✨  Done in 2.34s.
 /var/folders/sb/psmztz510s3dxcfzvj7cxlx80000gq/T/abc ❯ node index.js
npx: installed 25 in 5.443s
Starting up http-server, serving ./
Available on:
  http://127.0.0.1:8080
  http://10.101.24.241:8080
  http://10.101.24.215:8080
Hit CTRL-C to stop the server
^C^C^C^C^C^C^M^M^M^M^Czsh: killed     node index.js
❯ yarn why nodemon
yarn why v1.7.0
[1/4] 🤔  Why do we have the module "nodemon"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "nodemon@1.18.2-alpha.1"
info Has been hoisted to "nodemon"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "388KB"
info Disk size with unique dependencies: "912KB"
info Disk size with transitive dependencies: "7.75MB"
info Number of shared dependencies: 39
✨  Done in 0.38s.

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