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

Catch OSX port 5000 in-use #4415

Merged
merged 6 commits into from Apr 8, 2022
Merged

Catch OSX port 5000 in-use #4415

merged 6 commits into from Apr 8, 2022

Conversation

jamesdaniels
Copy link
Member

OSX is reserving port 5000 in a way that Node's http server is not erroring when you listen on it. Add a special case for this.

@jamesdaniels jamesdaniels requested a review from joehan April 8, 2022 19:18
Copy link
Contributor

@joehan joehan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this, this was super annoying! One potential extra edge case to cover, but this already looks like a nice improvement.

// enough devexp that we should special case and ensure it's available.
if (process.platform === "darwin") {
try {
execSync(`lsof -i :${port}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking through this, it seems like this only checks if the initial port is being used by osX, and will still break out if a subsequent attempt hits a osx occupied port. Should we include this if (platform == 'darwin') lsof in portInUse() as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

portInUse recurses, so it should work in subsequent attempts

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see line 54

@jamesdaniels
Copy link
Member Author

@joehan thanks for the quick turn around on your reviews today!

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.

None yet

2 participants