From c6efe8015224fe6dbc10d8f4b1aa52ce5afc9432 Mon Sep 17 00:00:00 2001 From: Roman Perepelitsa Date: Sat, 11 Jan 2020 09:48:45 +0100 Subject: [PATCH] runcoms: don't raise an error in zlogin when stderr is not a TTY (#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). --- runcoms/zlogin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runcoms/zlogin b/runcoms/zlogin index 16fae45..9ea9792 100644 --- a/runcoms/zlogin +++ b/runcoms/zlogin @@ -15,7 +15,7 @@ } &! # 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 @@ -23,4 +23,4 @@ print fi -} >&2 +fi >&2