From bf34b684b4cb2948bd5566873def7a971d617c8b Mon Sep 17 00:00:00 2001 From: Sashka <2721168+nochkin@users.noreply.github.com> Date: Wed, 6 Dec 2023 23:52:38 -0500 Subject: [PATCH] Don't fail when "ipconfig getifaddr" does not have IP The script used fail when IP is assigned to non-en0 interface because "ipconfig getifaddr en0" exits with 1 when IP is not assigned. That produced "PhaseScriptExecution failed with a nonzero exit code" in Xcode. The patch fixes this issue by removing "set -e" and re-enabling it later in the script. --- packages/react-native/scripts/react-native-xcode.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-native/scripts/react-native-xcode.sh b/packages/react-native/scripts/react-native-xcode.sh index c34ea666d782..ee50be3e7d4d 100755 --- a/packages/react-native/scripts/react-native-xcode.sh +++ b/packages/react-native/scripts/react-native-xcode.sh @@ -9,7 +9,7 @@ # and relies on environment variables (including PWD) set by Xcode # Print commands before executing them (useful for troubleshooting) -set -x -e +set -x DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH # Enables iOS devices to get the IP address of the machine running Metro @@ -27,6 +27,9 @@ if [[ ! "$SKIP_BUNDLING_METRO_IP" && "$CONFIGURATION" = *Debug* && ! "$PLATFORM_ echo "$IP" > "$DEST/ip.txt" fi +# Fail Xcode build if Build JS Bundle script phase fails +set -e + if [[ "$SKIP_BUNDLING" ]]; then echo "SKIP_BUNDLING enabled; skipping." exit 0;