Skip to content

Commit 1e5a65a

Browse files
committed
Fix script_phases.sh error() helper: missing echo + arg truncation (#56955)
The error() helper had two bugs since its extraction from the Ruby script in commit 1dbbeb4: 1. The line that mirrors the formatted message to SCRIPT_OUTPUT_FILE_0 was missing the leading echo, so [Codegen] $1 was instead being executed as a command. Under set -e this aborts the script with status 127 before reaching exit 1, and SCRIPT_OUTPUT_FILE_0 receives a shell command not found error instead of the intended log line. 2. The function only printed $1, so multi-arg callers like find_node (which passes its message across three space-and-backslash continuation strings) were silently truncated to the first chunk. Switch both lines to use $* so all positional arguments are joined into a single space-separated message, and add the missing echo so the second line actually appends to the log file. Fixes #56955.
1 parent b32a6c9 commit 1e5a65a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

packages/react-native/scripts/react_native_pods_utils/script_phases.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ cd "$RCT_SCRIPT_RN_DIR"
1616
CODEGEN_CLI_PATH=""
1717

1818
error () {
19-
echo "$1"
20-
"[Codegen] $1" >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
19+
# Print the full message (all positional args, space-separated) so multi-arg
20+
# callers like find_node don't get truncated to just $1. Mirror the same
21+
# message into SCRIPT_OUTPUT_FILE_0; the previous version was missing the
22+
# leading `echo`, so the formatted string was instead being executed as a
23+
# command and the shell error landed in the log file.
24+
echo "$*"
25+
echo "[Codegen] $*" >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
2126
exit 1
2227
}
2328

0 commit comments

Comments
 (0)