fix: Fix iOS build error when en0
is not available
#41873
Closed
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.
Summary:
Fixes a build error that happens when trying to find the host IP address.
The
react-native-xcode.sh
script tries to find the host machines IP address by looping through all network interfaces:This works when the network interface is on
en0
, but whenen0
is empty, it will immediately cause the build to fail, even though it would've worked on the next iteration (en1
).This is due to the fact that the script runs with
set -e
, meaning any error exit code will cause the entire script to fail - andipconfig
will return an exit code of1
when the network interfaceen0
can't be found.This fixes that error by ignoring the error codes of
ipconfig
, which is what the script was intended to do anyways (it loops over all 9 different interfaces), by adding a|| true
clause.Before:
After:
Changelog:
[IOS] [FIXED] - Fix 0.73 build error when
ipconfig
fails to find the IP addressTest Plan:
ipconfig getifaddr en0
returns nothing.