-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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: Restore CLI port in use prompt feature #25863
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,11 @@ import prompts from "prompts" | |
export const detectPortInUseAndPrompt = async ( | ||
port: number | ||
): Promise<number> => { | ||
let foundPort = port | ||
const detectedPort = await detectPort(port).catch((err: Error) => | ||
let foundPort = typeof port === `string` ? parseInt(port, 10) : port | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why did you have to add this code? TS states that the port has to be a number. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See last message I left in this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah oof. Seems like a mistake on the TS side then.. Wonder if we should fix this more globally. to make port always be a number. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I pushed up a change to handle the case early. Glad we found this discrepancy! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
EDIT: Nevermind, merged. |
||
const detectedPort = await detectPort(foundPort).catch((err: Error) => | ||
report.panic(err) | ||
) | ||
if (port !== detectedPort) { | ||
if (foundPort !== detectedPort) { | ||
report.log(`\nSomething is already running at port ${port}`) | ||
const response = await prompts({ | ||
type: `confirm`, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 looks like the same code from before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is. This PR is restoring that, as pointed out seems like it was accidentally removed.