Skip to content

Commit

Permalink
runcoms: don't raise an error in zlogin when stderr is not a TTY (sor…
Browse files Browse the repository at this point in the history
…in-ionescu#1775)

The existing code in runcoms/zlogin results in `$?` being
equal to `1` when starting a login shell if stderr is not
a TTY. For example:

  zsh -l 2>/dev/null

When using a theme that displays error/success status of
the last command, the first prompt will show an error.

This commit fixes it so that error code is zero after
sourcing zlogin (unless something unexpected and bad happens).
  • Loading branch information
RIT80 committed Jan 11, 2020
1 parent a0fbfa7 commit e8d8050
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runcoms/zlogin
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
} &!

# Execute code only if STDERR is bound to a TTY.
[[ -o INTERACTIVE && -t 2 ]] && {
if [[ -o INTERACTIVE && -t 2 ]]; then

# Print a random, hopefully interesting, adage.
if (( $+commands[fortune] )); then
fortune -s
print
fi

} >&2
fi >&2

0 comments on commit e8d8050

Please sign in to comment.