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

Created on 26 Mar 2017  路  7Comments  路  Source: webpack/webpack-dev-server

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

2 (regression) approved bug

Most helpful comment

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

All 7 comments

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

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

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

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

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.

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

@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.

Was this page helpful?
0 / 5 - 0 ratings