From 7aa3da1cd7e3221b6acac8e4f97cc2af2ed88dc9 Mon Sep 17 00:00:00 2001 From: senhuang42 Date: Tue, 22 Sep 2020 14:15:52 -0400 Subject: [PATCH] Use IS_CONSOLE macro to detect that we're indeed using a console --- programs/util.c | 4 ++++ tests/playTests.sh | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/programs/util.c b/programs/util.c index d828dc42..b4f1f402 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 d9407db8..44fd7400 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