Skip to content

Commit

Permalink
Fix Unix build issue (#42104)
Browse files Browse the repository at this point in the history
When native build fails, handle exit code properly by checking it immediately after cmake is called
  • Loading branch information
davidwrighton authored Sep 11, 2020
1 parent b1d613c commit cd7d23f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion eng/native/build-commons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,14 @@ EOF
export CXXFLAGS="${CXXFLAGS} ${EXTRA_CXXFLAGS}"
export LDFLAGS="${LDFLAGS} ${EXTRA_LDFLAGS}"

local exit_code
if [[ "$__StaticAnalyzer" == 1 ]]; then
pushd "$intermediatesDir"

buildTool="$SCAN_BUILD_COMMAND -o $__BinDir/scan-build-log $buildTool"
echo "Executing $buildTool install -j $__NumProc"
"$buildTool" install -j "$__NumProc"
exit_code="$?"

popd
else
Expand All @@ -185,13 +187,13 @@ EOF

echo "Executing $cmake_command --build \"$intermediatesDir\" --target install -- -j $__NumProc"
$cmake_command --build "$intermediatesDir" --target install -- -j "$__NumProc"
exit_code="$?"
fi

CFLAGS="${SAVED_CFLAGS}"
CXXFLAGS="${SAVED_CXXFLAGS}"
LDFLAGS="${SAVED_LDFLAGS}"

local exit_code="$?"
if [[ "$exit_code" != 0 ]]; then
echo "${__ErrMsgPrefix}Failed to build \"$message\"."
exit "$exit_code"
Expand Down

0 comments on commit cd7d23f

Please sign in to comment.