From ba2d82ff82b8c1525a288a3f7a889715123ff2d5 Mon Sep 17 00:00:00 2001 From: Alex Liang Date: Thu, 23 Jan 2025 15:49:17 +0000 Subject: [PATCH] chore: simplify exit --- tools/development/helpers/check-format-cpp.sh | 5 +++-- tools/development/helpers/check-format-python.sh | 5 +++-- tools/development/helpers/format-cpp.sh | 5 +++-- tools/development/helpers/format-python.sh | 5 +++-- tools/development/helpers/test-python.sh | 5 +++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/tools/development/helpers/check-format-cpp.sh b/tools/development/helpers/check-format-cpp.sh index a6574f0..64b9b29 100755 --- a/tools/development/helpers/check-format-cpp.sh +++ b/tools/development/helpers/check-format-cpp.sh @@ -6,6 +6,7 @@ project_directory="$(git rev-parse --show-toplevel)" pushd "${project_directory}" > /dev/null - clang-format -Werror --dry-run -style=file:thirdparty/clang/.clang-format $(find ~+ src/ include/ test/ bindings/python/src/ -name '*.cpp' -o -name '*.cxx' -o -name '*.hpp' -o -name '*.tpp') + clang-format -Werror --dry-run -style=file:thirdparty/clang/.clang-format $(find ~+ src/ include/ test/ bindings/python/src/ -name '*.cpp' -o -name '*.cxx' -o -name '*.hpp' -o -name '*.tpp') \ + || exit 1 -eval "popd > /dev/null; exit $?" # eval so $? is still the exit code of clang-format rather than popd +popd > /dev/null \ No newline at end of file diff --git a/tools/development/helpers/check-format-python.sh b/tools/development/helpers/check-format-python.sh index 0486767..2a676d5 100755 --- a/tools/development/helpers/check-format-python.sh +++ b/tools/development/helpers/check-format-python.sh @@ -6,6 +6,7 @@ project_directory="$(git rev-parse --show-toplevel)" pushd "${project_directory}" > /dev/null - python${OSTK_PYTHON_VERSION} -m black --check --diff bindings/python/ + python${OSTK_PYTHON_VERSION} -m black --check --diff bindings/python/ \ + || exit 1 -eval "popd > /dev/null; exit $?" # eval so $? is still the exit code of python rather than popd +popd > /dev/null \ No newline at end of file diff --git a/tools/development/helpers/format-cpp.sh b/tools/development/helpers/format-cpp.sh index 3b805e6..5b9168a 100755 --- a/tools/development/helpers/format-cpp.sh +++ b/tools/development/helpers/format-cpp.sh @@ -6,6 +6,7 @@ project_directory="$(git rev-parse --show-toplevel)" pushd "${project_directory}" > /dev/null - clang-format -i -style=file:thirdparty/clang/.clang-format $(find ~+ src/ include/ test/ bindings/python/src/ -name '*.cpp' -o -name '*.cxx' -o -name '*.hpp' -o -name '*.tpp') + clang-format -i -style=file:thirdparty/clang/.clang-format $(find ~+ src/ include/ test/ bindings/python/src/ -name '*.cpp' -o -name '*.cxx' -o -name '*.hpp' -o -name '*.tpp') \ + || exit 1 -eval "popd > /dev/null; exit $?" # eval so $? is still the exit code of clang-format rather than popd +popd > /dev/null \ No newline at end of file diff --git a/tools/development/helpers/format-python.sh b/tools/development/helpers/format-python.sh index d631adb..125e46b 100755 --- a/tools/development/helpers/format-python.sh +++ b/tools/development/helpers/format-python.sh @@ -6,6 +6,7 @@ project_directory="$(git rev-parse --show-toplevel)" pushd "${project_directory}" > /dev/null - python${OSTK_PYTHON_VERSION} -m black bindings/python/ + python${OSTK_PYTHON_VERSION} -m black bindings/python/ \ + || exit 1 -eval "popd > /dev/null; exit $?" # eval so $? is still the exit code of python rather than popd +popd > /dev/null \ No newline at end of file diff --git a/tools/development/helpers/test-python.sh b/tools/development/helpers/test-python.sh index b7dcfeb..479cbb5 100755 --- a/tools/development/helpers/test-python.sh +++ b/tools/development/helpers/test-python.sh @@ -7,6 +7,7 @@ test_directory="${project_directory}/bindings/python/test" pushd "${test_directory}" > /dev/null -python${OSTK_PYTHON_VERSION} -m pytest -sv ${@} + python${OSTK_PYTHON_VERSION} -m pytest -sv ${@} \ + || exit 1 -eval "popd > /dev/null; exit $?" # eval so $? is still the exit code of python rather than popd +popd > /dev/null \ No newline at end of file