From bfe349f90dccc4a4ea23e2fd0c8f5cd5d10f1fc1 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 7 Feb 2025 12:55:29 -0500 Subject: 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 --- tests/color.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') 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 -- cgit v1.2.3