Last active
July 26, 2021 22:44
-
-
Save dan-dr/9593a60cf9d5b7242b0cf0d97d64baf5 to your computer and use it in GitHub Desktop.
Kill webpack-dev-server with babun on windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: killwebpack [port] | |
# if no port is supplied then default port is 3000 | |
function killwebpack() { | |
PORT=3000 | |
if [ -n "$1" ] | |
then | |
PORT=$1 | |
fi | |
PID=`netstat -aon | grep $PORT | grep -P -m1 '(?<=LISTENING).*' -o | grep -P '\d*' -o` | |
if [ -z "$PID" ] | |
then | |
echo "couldn't find a process with port $PORT" | |
else | |
echo "killing process $PID with port $PORT" | |
taskkill /pid $PID /f | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment