Retrieve error code via PIPESTATUS

This commit is contained in:
Matthias Krack 2026-01-22 17:28:20 +01:00
parent 5671e2c755
commit 27b758b4a0

View file

@ -536,14 +536,18 @@ fi
# CMake build step
echo -e '\n*** Compiling CP2K ***\n'
if ! cmake --build "${CMAKE_BUILD_PATH}" --parallel "${NUM_PROCS}" -- "${VERBOSE_FLAG}" |& tee "${CMAKE_BUILD_PATH}/ninja.log"; then
cmake --build "${CMAKE_BUILD_PATH}" --parallel "${NUM_PROCS}" -- "${VERBOSE_FLAG}" |& tee "${CMAKE_BUILD_PATH}"/ninja.log
EXIT_CODE=${PIPESTATUS[0]}
if ((EXIT_CODE != 0)); then
echo "ERROR: The CMake build step failed with the error code ${EXIT_CODE}"
${EXIT_CMD} "${EXIT_CODE}"
fi
# CMake install step
echo -e '\n*** Installing CP2K ***\n'
if ! cmake --install "${CMAKE_BUILD_PATH}" |& tee "${CMAKE_BUILD_PATH}/install.log"; then
cmake --install "${CMAKE_BUILD_PATH}" |& tee "${CMAKE_BUILD_PATH}"/install.log
EXIT_CODE=${PIPESTATUS[0]}
if ((EXIT_CODE != 0)); then
echo "ERROR: The CMake installation step failed with the error code ${EXIT_CODE}"
${EXIT_CMD} "${EXIT_CODE}"
fi