Skip to content

Commit

Permalink
Enhance IP address retrieval for iOS devices in Metro bundler setup (f…
Browse files Browse the repository at this point in the history
…acebook#41839)

Summary:
After introducing this commit facebook@a56e5da script may fail in some circumstances.

Example:
When there is IP address available only for en1 and not en0, first "ipconfig" command in the loop fails with error code 1 and cancels whole script.

## Changelog:
[iOS] [Fixed] - [enhance IP address retrieval for iOS devices in Metro bundler setup](facebook@6a351db)

Pull Request resolved: facebook#41839

Reviewed By: christophpurrer

Differential Revision: D51979040

Pulled By: dmytrorykun

fbshipit-source-id: 0f6f42a7dd70bac012875ffae5d651b74b225c94
  • Loading branch information
Morritz authored and Othinn committed Jan 9, 2024
1 parent ea1a120 commit 31c299a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-native/scripts/react-native-xcode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH
# Enables iOS devices to get the IP address of the machine running Metro
if [[ ! "$SKIP_BUNDLING_METRO_IP" && "$CONFIGURATION" = *Debug* && ! "$PLATFORM_NAME" == *simulator ]]; then
for num in 0 1 2 3 4 5 6 7 8; do
IP=$(ipconfig getifaddr en${num})
IP=$(ipconfig getifaddr en${num} || echo "")
if [ ! -z "$IP" ]; then
break
fi
Expand Down

0 comments on commit 31c299a

Please sign in to comment.