@@ -115,36 +115,29 @@ function RunXcodebuild() {
115
115
116
116
local xcbeautify_cmd=(xcbeautify --renderer github-actions --disable-logging)
117
117
118
- # Run xcodebuild and capture the exit status of each command in the pipeline.
119
- NSUnbufferedIO=YES xcodebuild " $@ " 2>&1 | tee " $log_filename " | " ${xcbeautify_cmd[@]} "
120
- local pipe_statuses=( " ${PIPESTATUS [@]} " )
121
- local result=${pipe_statuses[0]}
118
+ local result=0
119
+ NSUnbufferedIO=YES xcodebuild " $@ " 2>&1 | tee " $log_filename " | \
120
+ " ${xcbeautify_cmd [@]} " && CheckUnexpectedFailures " $log_filename " \
121
+ || result=$?
122
122
123
- # If the first try failed with a potentially transient error (65), retry once.
124
123
if [[ $result == 65 ]]; then
125
124
ExportLogs " $@ "
125
+
126
126
echo " xcodebuild exited with 65, retrying" 1>&2
127
127
sleep 5
128
128
129
- NSUnbufferedIO=YES xcodebuild " $@ " 2>&1 | tee " $log_filename " | " ${xcbeautify_cmd[@]} "
130
- pipe_statuses=(" ${PIPESTATUS[@]} " )
131
- result=${pipe_statuses[0]}
129
+ result=0
130
+ NSUnbufferedIO=YES xcodebuild " $@ " 2>&1 | tee " $log_filename " | \
131
+ " ${xcbeautify_cmd[@]} " && CheckUnexpectedFailures " $log_filename " \
132
+ || result=$?
132
133
fi
133
134
134
- # If the command failed, print the relevant part of the raw log to avoid noise.
135
135
if [[ $result != 0 ]]; then
136
- echo " xcodebuild exited with $result . Showing relevant part of the raw log:" 1>&2
137
- # This awk script finds the first line matching one of the error patterns
138
- # and prints from that line to the end of the file. This avoids duplicating
139
- # successful build output.
140
- awk ' /error:|fatal:|terminated|\*\* (BUILD|TEST) FAILED \*\*/ {f=1} f' " $log_filename " 1>&2
136
+ echo " xcodebuild exited with $result " 1>&2
137
+
141
138
ExportLogs " $@ "
142
139
return $result
143
140
fi
144
-
145
- # If the command succeeded, check for unexpected test failures which don't
146
- # always cause xcodebuild to return a non-zero exit code.
147
- CheckUnexpectedFailures " $log_filename " || return $?
148
141
}
149
142
150
143
# Exports any logs output captured in the xcresult
0 commit comments