Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #19068 from atom/aw/preserve-exit-code
Browse files Browse the repository at this point in the history
Preserve Atom's exit code in atom.sh
  • Loading branch information
smashwilson committed Mar 28, 2019
1 parent 463e480 commit 30f2994
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions atom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,11 @@ if [ $OS == 'Mac' ]; then

if [ $EXPECT_OUTPUT ]; then
"$ATOM_PATH/$ATOM_APP_NAME/Contents/MacOS/$ATOM_EXECUTABLE_NAME" --executed-from="$(pwd)" --pid=$$ "$@"
if [ $? -eq 0 ] && [ -n "${EXIT_CODE_OVERRIDE}" ]; then
ATOM_EXIT=$?
if [ ${ATOM_EXIT} -eq 0 ] && [ -n "${EXIT_CODE_OVERRIDE}" ]; then
exit "${EXIT_CODE_OVERRIDE}"
else
exit $?
exit ${ATOM_EXIT}
fi
else
open -a "$ATOM_PATH/$ATOM_APP_NAME" -n --args --executed-from="$(pwd)" --pid=$$ --path-environment="$PATH" "$@"
Expand Down Expand Up @@ -169,10 +170,11 @@ elif [ $OS == 'Linux' ]; then

if [ $EXPECT_OUTPUT ]; then
"$ATOM_PATH" --executed-from="$(pwd)" --pid=$$ "$@"
if [ $? -eq 0 ] && [ -n "${EXIT_CODE_OVERRIDE}" ]; then
ATOM_EXIT=$?
if [ ${ATOM_EXIT} -eq 0 ] && [ -n "${EXIT_CODE_OVERRIDE}" ]; then
exit "${EXIT_CODE_OVERRIDE}"
else
exit $?
exit ${ATOM_EXIT}
fi
else
(
Expand Down

0 comments on commit 30f2994

Please sign in to comment.