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

Fix windows netstat usage #39

Merged

Conversation

baumatron
Copy link
Contributor

Hopefully fixes #3

netstat should get the -n parameter so it doesn't try to come up with a human readable name for ip addresses, which can take a long time and isn't needed.

The regex to match processes with the provided port should match only the first column of output from netstat because we only care about local ports and definitely don't won't to kill processes connected to a remote port that happens to be the port we provided.

This also adds the /F flag to taskkill which seemed needed to kill the process I tested with.

@faboweb
Copy link

faboweb commented Jan 20, 2020

Ping!

@faboweb faboweb mentioned this pull request Jan 20, 2020
5 tasks
@zdroyer
Copy link

zdroyer commented Feb 7, 2020

I just wanted to create a PR with this modification. On a windows machine 'netstat -ao' lists ALL the listening ports so without the '-n' switch it can take several seconds (my case), depending on the single hostname lookup time.

Similarly, lsof on Unix should be also called with -n switch, but it's less painful because only one port will be listed, but still it '-n' would make it faster.

@baumatron
Copy link
Contributor Author

@tiaanduplessis

@tiaanduplessis tiaanduplessis merged commit dfe44bc into tiaanduplessis:master Apr 15, 2020
@seahindeniz seahindeniz mentioned this pull request Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows compatibility
4 participants