diff --git a/bin/fetch.sh b/bin/fetch.sh index b5f4be6..ba6a1de 100644 --- a/bin/fetch.sh +++ b/bin/fetch.sh @@ -1,6 +1,6 @@ #!/bin/sh # fetch -# Written in 2019-2021 by Lucas +# Written in 2019-2022 by Lucas # CC0 1.0 Universal/Public domain - No rights reserved # # To the extent possible under law, the author(s) have dedicated all @@ -18,7 +18,11 @@ usage() fetch_cmd() { - if tty=$(tty) && [ "$tty" != "not a tty" ]; then + # ftp(1) is chatty if stdin is a terminal. It prints its operations to + # stdout if "-o output" is used. In that case, we'll need to redirect + # stdout to the tty we're being called from, in order to be able to + # pipe the output to another command. + if tty=$(tty) && [ X"$tty" != X"not a tty" ]; then $torsocks ftp "$@" >"$tty" else $torsocks ftp "$@"