summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2025-02-07 12:55:29 -0500
committerTavian Barnes <tavianator@tavianator.com>2025-02-07 12:57:16 -0500
commitbfe349f90dccc4a4ea23e2fd0c8f5cd5d10f1fc1 (patch)
tree051c9c965ea2a2dd294535c19a6cb741f8b37bec /tests
parentdd5df1f8997550c5bf49205578027715b957bd01 (diff)
downloadbfs-bfe349f90dccc4a4ea23e2fd0c8f5cd5d10f1fc1.tar.xz
tests/color: Use /dev/tty over $TTY
$TTY is the actual TTY, e.g. /dev/pts/3, which may not be accessible by the current user. This can happen e.g. if the PTY is owned by root, who then does root@host# su user user@host$ ./tests/tests.sh ./tests/color.sh: line 81: /dev/pts/3: Permission denied
Diffstat (limited to 'tests')
-rw-r--r--tests/color.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/color.sh b/tests/color.sh
index 4f4312e..8447824 100644
--- a/tests/color.sh
+++ b/tests/color.sh
@@ -78,7 +78,7 @@ hide_bar() {
# The background process that muxes multiple status bars for one TTY
bar_proc() {
# Read from the pipe, write to the TTY
- exec <"$1" >"$TTY"
+ exec <"$1" >/dev/tty
# Delete the pipe when done
defer rm "$1"
@@ -133,7 +133,7 @@ bar_proc() {
# Resize the status bar
resize_bar() {
# Bash gets $LINES from stderr, so if it's redirected use tput instead
- TTY_HEIGHT="${LINES:-$(tput lines 2>"$TTY")}"
+ TTY_HEIGHT="${LINES:-$(tput lines 2>/dev/tty)}"
if ((BAR_HEIGHT == 0)); then
return