Skip to content

Simplify occupied port handling in start command#39078

Closed
huntie wants to merge 3 commits into
react:mainfrom
huntie:export-D48433285
Closed

Simplify occupied port handling in start command#39078
huntie wants to merge 3 commits into
react:mainfrom
huntie:export-D48433285

Conversation

@huntie

@huntie huntie commented Aug 18, 2023

Copy link
Copy Markdown
Member

Summary:
Simplifies and hardens behaviour for detecting other processes / dev server instances when running react-native start.

  • New flow:
    • Exits with error message if port is taken by another process (no longer suggests next port).
    • Exits with info message if port is taken by another instance of this dev server (unchanged).
    • Continues if result unknown.
    • (No longer logs dedicated message for another RN server running in a different project root.)
  • This now checks if the TCP port is in use before attempting an HTTP fetch.

Previous behaviour: handlePortUnavailable. This decouples us from some lower-level react-native-community/cli-tools utils, which remain reused by the android and ios commands.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D48433285

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Aug 18, 2023
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D48433285

@analysis-bot

analysis-bot commented Aug 18, 2023

Copy link
Copy Markdown
Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,960,405 +210
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 9,551,190 +15
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 8b62200
Branch: main

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D48433285

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D48433285

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D48433285

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D48433285

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D48433285

Alex Hunt and others added 3 commits August 22, 2023 12:54
Summary:
Follow-up to react#38988.

- Upgrade to RN CLI `12.0.0-alpha.10`.
- Restore previous value check against `/status` response in test scripts (restored in above CLI alpha).

Changelog: [Internal]

Differential Revision: https://internalfb.com/D48432629

fbshipit-source-id: 755be14a954c28f807eed94238e9f3497fdda9c0
Summary:
Pull Request resolved: react#39075

Small refactor: reorganise command entry points and types into a consistent pattern.

Changelog: [Internal]

Differential Revision: https://internalfb.com/D48433284

fbshipit-source-id: 5cc145b474c8c5cbf350cfee1a1b92091afd9b18
Summary:
Pull Request resolved: react#39078

Simplifies and hardens behaviour for detecting other processes / dev server instances when running `react-native start`.

- New flow:
    - Exits with error message if port is taken by another process (*no longer suggests next port*).
    - Exits with info message if port is taken by another instance of this dev server (**unchanged**).
    - Continues if result unknown.
    - *(No longer logs dedicated message for another RN server running in a different project root.)*
- This now checks if the TCP port is in use before attempting an HTTP fetch.

Previous behaviour: [`handlePortUnavailable`](https://github.com/react-native-community/cli/blob/734222118707fff41c71463528e4e0c227b31cc6/packages/cli-tools/src/handlePortUnavailable.ts#L8). This decouples us from some lower-level `react-native-community/cli-tools` utils, which remain reused by the `android` and `ios` commands.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D48433285

fbshipit-source-id: 22ed8b050a6ce729d19cc46da377697547a32582
huntie added a commit to huntie/react-native that referenced this pull request Aug 22, 2023
Summary:
Pull Request resolved: react#39078

Simplifies and hardens behaviour for detecting other processes / dev server instances when running `react-native start`.

- New flow:
    - Exits with error message if port is taken by another process (*no longer suggests next port*).
    - Exits with info message if port is taken by another instance of this dev server (**unchanged**).
    - Continues if result unknown.
    - *(No longer logs dedicated message for another RN server running in a different project root.)*
- This now checks if the TCP port is in use before attempting an HTTP fetch.

Previous behaviour: [`handlePortUnavailable`](https://github.com/react-native-community/cli/blob/734222118707fff41c71463528e4e0c227b31cc6/packages/cli-tools/src/handlePortUnavailable.ts#L8). This decouples us from some lower-level `react-native-community/cli-tools` utils, which remain reused by the `android` and `ios` commands.

Changelog: [Internal]

Differential Revision: https://internalfb.com/D48433285

fbshipit-source-id: c893444eafc19dd3bfc7cc91995550f6e8372e3f
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D48433285

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Aug 22, 2023
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request has been merged in 13eda31.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants