From a3dec9576dcb7151c492ed35a25169b5e54fbbe9 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Thu, 5 May 2022 13:39:13 +0100 Subject: [PATCH] Minor improvement to cleanup() - Always detect terminal first Signed-off-by: Richard T Bonhomme --- easyrsa3/easyrsa | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index fbdd7b5..d454133 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -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