fix: don't override --port=0 with the default port#619
Open
gabrielcnb wants to merge 1 commit into
Open
Conversation
getPortFromArgs returns 0 for --port=0, which the falsy check treated as no port and overrode with --port=9515, dropping the user's request for an os-assigned ephemeral port. check for undefined instead, and resolve the start() promise immediately for port 0 since the chosen port is unknown and cannot be polled.
🚦Reports 🚦Reports will be posted here as they become available. |
Author
|
tested locally before opening: npm test (19 passing), lint and typecheck pass. the build here is waiting on approval to run. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
passing
--port=0tostart()is silently ignored.getPortFromArgsreturns the number0, and theif (!port)check treats0as falsy, so it overrides the user's request with--port=9515.--port=0is a valid way to ask the os for a free ephemeral port, which is useful to avoid the fixed 9515 collision when running parallel instances on ci.changes:
port === undefinedinstead of!port, so only a missing port triggers the default.port === 0. the os picks a random port we can't know here, sotcpPortUsed.waitUntilUsed(0, ...)would just time out and reject.added tests for the default port,
--port=0, and an explicit port.npm test, lint and typecheck pass.