Skip to content

Commit

Permalink
fix(script): ensure current directory is preserved during execution
Browse files Browse the repository at this point in the history
- Add pushd/popd to maintain the current working directory integrity
- Remove unnecessary TMP_CWD variable and cd command

Issue NMO-388

[skip release]
  • Loading branch information
RedLeader962 committed Aug 6, 2024
1 parent 6798139 commit a0a27a5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utility_scripts/which_architecture_and_os.bash
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# exit 1 in case of unsupported processor architecture
#
# =================================================================================================
pushd "$(pwd)" >/dev/null || exit 1

# ....Pre-condition................................................................................
if [[ "$(basename "$(pwd)")" != "utility_scripts" ]]; then
Expand All @@ -33,8 +34,6 @@ if [[ "$(basename "$(pwd)")" != "utility_scripts" ]]; then
fi

# ....Load helper function.........................................................................
TMP_CWD=$(pwd)

# (Priority) ToDo: validate!! (ref task NMO-388 fix: explicitly sourcing .env.n2st cause conflicting problem when the repo is used as a lib)
if [[ -z $PROJECT_PROMPT_NAME ]] && [[ -z $PROJECT_GIT_NAME ]] ; then
set -o allexport
Expand All @@ -45,8 +44,9 @@ fi
cd ../function_library || exit 1
source ./general_utilities.bash

cd "${TMP_CWD}"

# ====Begin========================================================================================
n2st::set_which_architecture_and_os

# ====Teardown=====================================================================================
popd >/dev/null || exit 1

0 comments on commit a0a27a5

Please sign in to comment.