Minor improvement to cleanup() - Always detect terminal first

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
Richard T Bonhomme 2022-05-05 13:39:13 +01:00
parent 36543be760
commit a3dec9576d
No known key found for this signature in database
GPG Key ID: 2D767DB92FB6C246

View File

@ -432,8 +432,14 @@ cleanup() {
# shellcheck disable=SC3040 # In POSIX sh, set option [name] is undefined
case "$easyrsa_host_os" in
nix) stty echo ;;
win) set -o echo ;;
nix) [ -t 1 ] && stty echo ;;
win)
if [ "$easyrsa_win_git_bash" ]; then
[ -t 1 ] && stty echo
else
set -o echo
fi
;;
*) warn "Host OS undefined."
esac
[ "$EASYRSA_SILENT" ] || echo "" # just to get a clean line