-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Check all local hosts for port availability #56
Check all local hosts for port availability #56
Conversation
Should we update the docs about this new behavior? |
@sindresorhus added a clarification to docs, but i'm not sure if there is anything else that should be documented about this change? I think the new behavior would be the expected behavior. |
Tests seems to be failing on macOS. |
@sindresorhus yes, I mentioned that in the PR description as well - what would you suggest should be done here? The failing test is not the one added in this PR, rather an older test "ports are locked for up to 30 seconds". That test failed before the changes in this PR, too - I added the multi-os test runs in 74f6443 and the tests failed for that commit already. I'm not sure what's going on there and I don't have a Mac OS machine to debug that properly. |
Should fix #31 and fix #48.
Note that the solution is copied from #52, with some comments resolved that were not fixed in that PR. Decided to file a new one, because #52 hasn't been updated in months and I would like to get this resolved - lately there have been more and more reports of the "automatic port selection" not working in several projects.
Answering some comments here:
Not sure how to test this "more comprehensively". I "resolved" this comment by making the tests run in CI on macos and windows, too, where the added test failed without the fix (see this run). This makes sense to me, because networking and port allocation seem to depend on the operating system. There are however some issues with the 30s test on macos (it sometimes fails), not sure how to fix that?
To me it seems like an issue with how get-port checks port availability, and not how Node's net module works. But to be fair I cannot wrap my brain around how networking and port locking works, so :) The fix seems to work, however, at least in tests.