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

webpack-dev-server does not stop on Ctrl+C #860

Closed
h6ah4i opened this issue Mar 26, 2017 · 7 comments
Closed

webpack-dev-server does not stop on Ctrl+C #860

h6ah4i opened this issue Mar 26, 2017 · 7 comments

Comments

@h6ah4i
Copy link

h6ah4i commented Mar 26, 2017

Hi. I noticed that the latest version v2.4.2 have an issue around process signal handling. Pressing Ctrl+C to stop webpack-dev-server does not work while compiling assets. (NOTE: Ctrl+C works well after finished compilation.)

Also, I reverted the change of the PR #787 to workaround the issue for now.

OS: macOS 10.12.3
webpack-dev-server 2.4.2
webpack 2.3.2

@shellscape
Copy link
Contributor

@h6ah4i please confirm that this is still an issue with 2.7.1

@h6ah4i
Copy link
Author

h6ah4i commented Aug 9, 2017

@shellscape Yep, I can still reproduce the same issue with 2.7.1.

@shellscape
Copy link
Contributor

@h6ah4i thanks, we'll look at fixing this over the coming weeks

@minya92
Copy link

minya92 commented Aug 22, 2017

I use this script (on windows), but it is not good (webpack-dev-server version 2.7.1)
taskkill /F /IM node.exe /T

@dwjohnston
Copy link

dwjohnston commented Sep 9, 2017

If anyone else is intersested in I'm using:

"taskkill //pid `netstat -aon | grep 8000 | grep -P '(?<=LISTENING).*' -o | grep -P '\\d*' -o` //f"

to kill on the specific port.

@axdemelas
Copy link

axdemelas commented Oct 4, 2017

We can improve @dwjohnston suggestion by setting his command as a bash alias to avoid typing the command from scratch every time .

  1. Open .bashrc file:
vim ~/.bashrc
  1. Add alias (port 3000, in my case):
alias killwebpack="taskkill //pid \`netstat -aon | grep 3000 | grep -P '(?<=LISTENING).*' -o | grep -P '\\d*' -o\` //f"
  1. Restart terminal and run whenever you need:
killwebpack

@shellscape
Copy link
Contributor

@h6ah4i @minya92 @dwjohnston @ahlechandre please check out and try this branch: https://github.com/webpack/webpack-dev-server/tree/fix-sigint-edge

I believe I identified a potential race condition between server.close() and process.exit(). Pull Request #1157 adds a test to confirm that SIGINT detection is working correctly. Outside of that pure Node environment, issues with that are likely going to be tied to the console setup of a particular user.

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

6 participants