tiaanduplessis / kill-port

❌ Kill the process running on given port

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inaccurately matches against other ports for unix.

AndrewSouthpaw opened this issue · comments

Repro:

Run lsof -i -P and pick a port that is running where no substring of the port is running, e.g.

Google    62775 andrew   89u  IPv4 ...  TCP 192.168.0.0:49302->...:443 (ESTABLISHED)
# no port 9302

Then run kill-port 9302, it prints:

$ npx kill-port 9302
Process on port 9302 killed

This is because the regex is incorrect:

https://github.com/tiaanduplessis/kill-port/blob/master/index.js#L39