From 236a19a9744a244440eda4f07b17e515e854bd7f Mon Sep 17 00:00:00 2001 From: dmayle Date: Wed, 7 Jan 2015 18:11:10 -0800 Subject: [PATCH] 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. --- usr/bin/byobu.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr/bin/byobu.in b/usr/bin/byobu.in index 256d525b..7a2bc245 100755 --- a/usr/bin/byobu.in +++ b/usr/bin/byobu.in @@ -93,10 +93,12 @@ fi # Sanitize the environment byobu-janitor --force -# Set the window title -[ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc" -. $BYOBU_PREFIX/lib/$PKG/ip_address -[ -n "$BYOBU_NO_TITLE" ] || printf "\033]0;${USER}@$(hostname) ($(__ip_address t)) - ${PKG}\007" +# Set the window title if this is a TTY +if [ -t 1 ]; then + [ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc" + . $BYOBU_PREFIX/lib/$PKG/ip_address + [ -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 if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then