fi
fi
-# Colorize stderr in bold red. Very useful when looking for errors. Thanks to
-# http://gentoo-wiki.com/wiki/Zsh for the basic script and Mikachu in #zsh on
-# Freenode (2010-03-07 04:03 CET) for some improvements (-r, printf). It's not
-# yet perfect and doesn't work with su and git for example, but it can handle
-# most interactive output quite well (even with no trailing new line) and in
-# cases it doesn't work, the E alias can be used as workaround.
-#
-# Moved in the "run commands" section to prevent one unnecessary zsh process
-# when starting GNU screen/tmux (see above).
-exec 2>>(while read -r -k -u 0 line; do
- printf '\e[91m%s\e[0m' "$line"
- print -n $'\0'
-done &)
+# Colorize stderr in bold red. Very useful when looking for errors.
+if [[ $LD_PRELOAD != *libcoloredstderr.so* ]]; then
+ # coloredstderr found, use it.
+ if [[ -f ~/.zsh/libcoloredstderr.so ]]; then
+ export LD_PRELOAD="$HOME/.zsh/libcoloredstderr.so:$LD_PRELOAD"
+ export COLORED_STDERR_FDS=2,
+ export COLORED_STDERR_PRE=$'\033[91m' # bright red
+ export COLORED_STDERR_IGNORED_BINARIES=/usr/bin/tset
+ # Use the fallback solution.
+ #
+ # Thanks to http://gentoo-wiki.com/wiki/Zsh for the basic script and
+ # Mikachu in #zsh on Freenode (2010-03-07 04:03 CET) for some improvements
+ # (-r, printf). It's not yet perfect and doesn't work with su and git for
+ # example, but it can handle most interactive output quite well (even with
+ # no trailing new line) and in cases it doesn't work, the E alias can be
+ # used as workaround.
+ #
+ # Moved in the "run commands" section to prevent one unnecessary zsh
+ # process when starting GNU screen/tmux (see above).
+ else
+ exec 2>>(while read -r -k -u 0 line; do
+ printf '\e[91m%s\e[0m' "$line"
+ print -n $'\0'
+ done &)
+ fi
+fi
# Display possible log messages from ~/.xinitrc (if `xmessage` wasn't
# installed). No race condition as xinitrc has finished before a shell is