From 17ef04b41ab8716f2eeb8fe59057a8e85a76e28b Mon Sep 17 00:00:00 2001 From: Lucas Date: Sun, 3 May 2020 13:53:19 +0000 Subject: [PATCH] fetch: use a slightly more correct check for TTY stdin --- bin/fetch.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/fetch.sh b/bin/fetch.sh index 6542972..5f3c159 100644 --- a/bin/fetch.sh +++ b/bin/fetch.sh @@ -1,6 +1,6 @@ #!/bin/sh # fetch -# Written in 2019 by Lucas +# Written in 2019-2020 by Lucas # CC0 1.0 Universal/Public domain - No rights reserved # # To the extent possible under law, the author(s) have dedicated all @@ -12,14 +12,14 @@ usage() { - printf "Usage: %s [-T] URL [URL ...]\n" "${0##*/}">&2 + printf "Usage: %s [-T] URL [URL ...]\n" "${0##*/}" >&2 exit 1 } fetch_cmd() { - if [ -t 0 ]; then - $torsocks ftp "$@" >$(tty) + if tty=$(tty) && [ "$tty" != "not a tty" ]; then + $torsocks ftp "$@" >"$tty" else $torsocks ftp "$@" fi