Commit f14207f
Fix codegen script phase error logging (#56956)
Summary:
This fixes the `error()` helper in `packages/react-native/scripts/react_native_pods_utils/script_phases.sh` so it logs messages instead of attempting to execute them as shell commands.
The current implementation does:
```bash
"[Codegen] $1" >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
```
That causes the error path to fail with `command not found` under `set -e`, writes the shell error to `SCRIPT_OUTPUT_FILE_0` instead of the intended `[Codegen] ...` line, and truncates multi-part messages to `$1`.
This change captures the full message with `$*`, prints it to stdout, and appends the formatted `[Codegen] ...` line to `SCRIPT_OUTPUT_FILE_0`.
Fixes #56955.
## Changelog:
[IOS] [FIXED] - Fix codegen script phase error logging in `script_phases.sh`
Pull Request resolved: #56956
Test Plan:
```bash
bash -n packages/react-native/scripts/react_native_pods_utils/script_phases.sh
```
```bash
bash -lc 'set +e; bash -lc '\''set -e; rm -f /tmp/rn-codegen-test.log; f(){ message="$*"; echo "$message"; echo "[Codegen] $message" >> /tmp/rn-codegen-test.log 2>&1; exit 1; }; f hello world'\''; status=$?; echo STATUS=$status; echo LOG_CONTENT_START; cat /tmp/rn-codegen-test.log 2>/dev/null; echo LOG_CONTENT_END'
```
Observed output:
```text
hello world
STATUS=1
LOG_CONTENT_START
[Codegen] hello world
LOG_CONTENT_END
```
Reviewed By: christophpurrer
Differential Revision: D106401068
Pulled By: zeyap
fbshipit-source-id: 1ca73c20d5b935f3451e4c48da171b6f6c22201f1 parent d4ae881 commit f14207f
1 file changed
Lines changed: 3 additions & 2 deletions
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
0 commit comments