fix: surface forge script errors in CI bootstrap log

run_forge_script() was piping all output to LOG_FILE (which is /dev/null
in CI), so forge failures were completely silent.  Capture output to a
temp file and print to stderr on failure so the CI log shows the actual
error message.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-12 23:27:23 +00:00
parent 73a80ead0b
commit e0b61c1b88

View file

@ -53,7 +53,17 @@ wait_for_rpc() {
run_forge_script() {
bootstrap_log "Deploying contracts to fork"
pushd "$ONCHAIN_DIR" >/dev/null
forge script script/DeployLocal.sol --tc DeployLocal --fork-url "$ANVIL_RPC" --broadcast >>"$LOG_FILE" 2>&1
local _forge_log
_forge_log="$(mktemp)"
if ! forge script script/DeployLocal.sol --tc DeployLocal --fork-url "$ANVIL_RPC" --broadcast >"$_forge_log" 2>&1; then
bootstrap_log "forge script FAILED — output:"
cat "$_forge_log" >&2
rm -f "$_forge_log"
popd >/dev/null
return 1
fi
cat "$_forge_log" >>"$LOG_FILE" 2>/dev/null || true
rm -f "$_forge_log"
popd >/dev/null
}