diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2025-02-12 19:30:29 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2025-02-12 19:30:29 -0800 |
commit | 71381b41e833e759950e72c5234c06e5924027bd (patch) | |
tree | 9917d4c8ed9fcef28be4f1fa4dd2b82b192ac9af | |
parent | 431ed945f940c4c526f55096045f603d06787967 (diff) | |
download | basta-71381b41e833e759950e72c5234c06e5924027bd.tar.gz basta-71381b41e833e759950e72c5234c06e5924027bd.tar.bz2 basta-71381b41e833e759950e72c5234c06e5924027bd.zip |
fullscreen: handle stdin/stdout not being a TTY.
* basta.sh (basta.fullscreen, basta.fullscreen_alt): Only
perform the special fullscreening logic if the standard input
and output are a TTY. If either one is not a TTY, then just
run the command and return its status. Otherwise if the
program is redirected, the codes we send to the terminal
get mixed up in the output. This test isn't perfect, because
programs could bre redirected to a TTY which is not the
controlling TTY. This is rare to do, and users probably
won't be doing this with their basta.fullscreen aliases.
-rw-r--r-- | basta.sh | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -290,6 +290,11 @@ basta.import_array() # Public API functions basta.fullscreen() { + if ! [ -t 0 -a -t 1 ] ; then + command "$@" + return $? + fi + local realrows=$(( LINES + basta_prev_reserved_rows + 1 )) local exit= local saveint=$(trap -p INT) @@ -308,6 +313,11 @@ basta.fullscreen() { } basta.fullscreen_alt() { + if ! [ -t 0 -a -t 1 ] ; then + command "$@" + return $? + fi + local realrows=$(( LINES + basta_prev_reserved_rows + 1 )) local curline local i |