Don't pollute output with title if calling from script.

Extracting output from byobu in a script will receive garbage control codes that don't belong.  Check if the script is called from a terminal before deciding to send window update control codes.
This commit is contained in:
dmayle 2015-01-07 18:11:10 -08:00
commit 236a19a974

View file

@ -93,10 +93,12 @@ fi
# Sanitize the environment # Sanitize the environment
byobu-janitor --force byobu-janitor --force
# Set the window title # Set the window title if this is a TTY
if [ -t 1 ]; then
[ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc" [ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc"
. $BYOBU_PREFIX/lib/$PKG/ip_address . $BYOBU_PREFIX/lib/$PKG/ip_address
[ -n "$BYOBU_NO_TITLE" ] || printf "\033]0;${USER}@$(hostname) ($(__ip_address t)) - ${PKG}\007" [ -n "$BYOBU_NO_TITLE" ] || printf "\033]0;${USER}@$(hostname) ($(__ip_address t)) - ${PKG}\007"
fi
# Drop a symlink to the ssh socket in $HOME, since we can ensure that exists # Drop a symlink to the ssh socket in $HOME, since we can ensure that exists
if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then