]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Use IS_CONSOLE macro to detect that we're indeed using a console
authorsenhuang42 <senhuang96@fb.com>
Tue, 22 Sep 2020 18:15:52 +0000 (14:15 -0400)
committersenhuang42 <senhuang96@fb.com>
Tue, 22 Sep 2020 18:15:52 +0000 (14:15 -0400)
programs/util.c
tests/playTests.sh

index d828dc42831daca732f96c5b010c1b80c3609a20..b4f1f402e8252795b7623d78a63906db3a7fbe8a 100644 (file)
@@ -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;
index d9407db89834fedd3fa16ea7fc5f5b9f911db747..44fd74008b9051211d691e0e83c2419e275596a4 100755 (executable)
@@ -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