Skip to content

Commit

Permalink
fix(build): ensure script exits on directory change failure
Browse files Browse the repository at this point in the history
- Added 'exit 1' to all directory change (cd) commands to ensure the script exits if they fail.
- This prevents the script from continuing in an incorrect directory and potentially causing errors.
  • Loading branch information
RedLeader962 committed Sep 14, 2024
1 parent 248da94 commit 08729a2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions build_system/ubuntu/lpm_install_libpointmatcher_ubuntu.bash
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export DEBIAN_FRONTEND=noninteractive
TMP_CWD=$(pwd)

LPM_PATH=$(git rev-parse --show-toplevel)
cd "${LPM_PATH}/build_system" || exit
cd "${LPM_PATH}/build_system" || exit 1

# ....Load environment variables from file.........................................................
set -o allexport
Expand Down Expand Up @@ -176,7 +176,7 @@ teamcity_service_msg_blockOpened "Install ${NBS_REPOSITORY_NAME}"

mkdir -p "${NBS_LIB_INSTALL_PATH}"
print_msg "Directories (pre libpointmatcher install)$(tree -L 2 "${NBS_LIB_INSTALL_PATH}")"
cd "${NBS_LIB_INSTALL_PATH}" || exit
cd "${NBS_LIB_INSTALL_PATH}" || exit 1

# ....Repository cloning step......................................................................
if [[ ${BUILD_SYSTEM_CI_INSTALL} == FALSE ]]; then
Expand All @@ -188,7 +188,7 @@ if [[ ${BUILD_SYSTEM_CI_INSTALL} == FALSE ]]; then
git clone https://github.com/"${NBS_REPOSITORY_DOMAIN}"/"${NBS_REPOSITORY_NAME}".git

if [[ "${REPOSITORY_VERSION}" != 'latest' ]]; then
cd "${NBS_REPOSITORY_NAME}" || exit
cd "${NBS_REPOSITORY_NAME}" || exit 1

git fetch --tags
git tag --list
Expand All @@ -203,7 +203,7 @@ if [[ ${BUILD_SYSTEM_CI_INSTALL} == FALSE ]]; then
fi
fi

cd "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}" || exit
cd "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}" || exit 1
mkdir -p build && cd build

# ....Cmake install step...........................................................................
Expand Down Expand Up @@ -279,4 +279,4 @@ fi
print_formated_script_footer "${CALLER_NAME} (${IMAGE_ARCH_AND_OS})" "${MSG_LINE_CHAR_INSTALLER}"

# ====Teardown=====================================================================================
cd "${TMP_CWD}" || exit
cd "${TMP_CWD}" || exit 1

0 comments on commit 08729a2

Please sign in to comment.