From: senhuang42 Date: Tue, 22 Sep 2020 18:15:52 +0000 (-0400) Subject: Use IS_CONSOLE macro to detect that we're indeed using a console X-Git-Tag: v1.4.7~68^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7aa3da1cd7e3221b6acac8e4f97cc2af2ed88dc9;p=thirdparty%2Fzstd.git Use IS_CONSOLE macro to detect that we're indeed using a console --- diff --git a/programs/util.c b/programs/util.c index d828dc428..b4f1f402e 100644 --- a/programs/util.c +++ b/programs/util.c @@ -90,6 +90,10 @@ int g_utilDisplayLevel; int UTIL_requireUserConfirmation(const char* prompt, const char* abortMsg, const char* acceptableLetters) { int ch, result; + /* If input is presented via stdin, dont use prompt as it may swallow characters */ + if (!IS_CONSOLE(stdin)) + return 0; + UTIL_DISPLAY("%s", prompt); ch = getchar(); result = 0; diff --git a/tests/playTests.sh b/tests/playTests.sh index d9407db89..44fd74008 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -309,7 +309,6 @@ test -f precompressedFilterTestDir/input.5.zst.zst test -f precompressedFilterTestDir/input.6.zst.zst println "Test completed" - println "\n===> recursive mode test " # combination of -r with empty list of input file zstd -c -r < tmp > tmp.zst