Skip to content

Commit

Permalink
Merge pull request #37 from eush77/shellrc-status
Browse files Browse the repository at this point in the history
Fix shell hook status
  • Loading branch information
jamesob committed Nov 17, 2015
2 parents d4edaf0 + d93b967 commit 0726292
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions desk
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,15 @@ cmd_init() {

echo "# Hook for desk activation" >> "$USER_SHELLRC"

# Since the hook is appended to the rc file, its exit status becomes
# the exit status of `source $USER_SHELLRC` which typically
# indicates if something went wrong. If $DESK_ENV is void, `test`
# sets exit status to 1. That, however, is part of desk's normal
# operation, so we clear exit status after that.
if [ "$SHELLTYPE" == "fish" ]; then
echo "test -n \"\$DESK_ENV\"; and . \"\$DESK_ENV\"" >> "$USER_SHELLRC"
echo "test -n \"\$DESK_ENV\"; and . \"\$DESK_ENV\"; or true" >> "$USER_SHELLRC"
else
echo "[ -n \"\$DESK_ENV\" ] && source \"\$DESK_ENV\"" >> "$USER_SHELLRC"
echo "[ -n \"\$DESK_ENV\" ] && source \"\$DESK_ENV\" || true" >> "$USER_SHELLRC"
fi

echo "Done. Start adding desks to ${NEW_PREFIX}/desks!"
Expand Down

0 comments on commit 0726292

Please sign in to comment.