Skip to content

Commit

Permalink
Replace exit 1 with return
Browse files Browse the repository at this point in the history
Swap is to avoid annoyingly closing a user's shell if there is an issue.
The error message will still be the last line and user gets their shell
back.
  • Loading branch information
TimothyWillard committed Oct 4, 2024
1 parent 4ba381f commit 057d3f6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions build/hpc_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ elif [[ $1 == "rockfish" ]]; then
module load git/2.42.0
else
echo "The cluster name '$1' is not recognized, must be one of: 'longleaf', 'rockfish'."
exit 1
return
fi

# Make sure the credentials is is where we expect and have the right perms
if [ ! -f "$USERDIR/slack_credentials.sh" ]; then
echo "You need to place sensitive credentials in '$USERDIR/slack_credentials.sh'."
exit 1
return
fi
chmod 600 $USERDIR/slack_credentials.sh
source $USERDIR/slack_credentials.sh
Expand All @@ -49,7 +49,7 @@ if [ ! -d "$FLEPI_PATH" ]; then
git clone git@github.com:HopkinsIDD/flepiMoP.git $FLEPI_PATH
elif [ ! -d "$FLEPI_PATH/.git" ]; then
echo "The flepiMoP found at '$FLEPI_PATH' is not a git clone, unsure of how to proceed."
exit 1
return
fi

# Setup the conda environment
Expand Down Expand Up @@ -82,11 +82,11 @@ WHICH_PYTHON_OKAY=$( echo "$WHICH_PYTHON" | grep "flepimop-env" | wc -l )
WHICH_R_OKAY=$( echo "$WHICH_R" | grep "flepimop-env" | wc -l )
if [[ "$WHICH_PYTHON_OKAY" -ne 1 ]]; then
echo "The python found is '$WHICH_PYTHON', which does not contain the expected 'flepimop-env'."
exit 1
return
fi
if [[ "$WHICH_R_OKAY" -ne 1 ]]; then
echo "The R found is '$WHICH_R', which does not contain the expected 'flepimop-env'."
exit 1
return
fi
PYTHON_ARROW_VERSION=$( python -c "import pyarrow; print(pyarrow.__version__)" )
R_ARROW_VERSION=$( Rscript -e "cat(as.character(packageVersion('arrow')))" )
Expand Down

1 comment on commit 057d3f6

@pearsonca
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm, do these want to be returns or exits? Cursory googling suggests exit is the appropriate one, but might be too cursory: https://stackoverflow.com/questions/4419952/difference-between-return-and-exit-in-bash-functions

Please sign in to comment.