Skip to content

Commit

Permalink
bugfix double exit
Browse files Browse the repository at this point in the history
  • Loading branch information
ulfaslak committed Oct 8, 2024
1 parent 32049d8 commit 35a4420
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ trap exit_gracefully SIGINT SIGTERM EXIT

# Flag to track if changes are reversible
reversible_changes=true
did_exit=false

execute_command() {
echo -e " \033[36m$ $1\033[0m"
Expand Down Expand Up @@ -57,12 +58,15 @@ validate_repo_url() {
}

exit_gracefully() {
if [ "$reversible_changes" = true ]; then
echo -e "\n\033[31mAboring Setup:\033[0m"
echo -e " Reverting changes, try again:"
execute_command "git reset --hard && git clean -fd"
if [ "$did_exit" = false ]; then
if [ "$reversible_changes" = true ]; then
echo -e "\n\033[31mAboring Setup:\033[0m"
echo -e " Reverting changes, try again:"
execute_command "git reset --hard && git clean -fd"
fi
did_exit=true
exit 1
fi
exit 1
}

rename_package() {
Expand Down

0 comments on commit 35a4420

Please sign in to comment.