diff --git a/programs/fileio.c b/programs/fileio.c index e8d25ab9..1fb8aace 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -2030,6 +2030,12 @@ static int FIO_listFile(fileInfo_t* total, const char* inFileName, int displayLe } int FIO_listMultipleFiles(unsigned numFiles, const char** filenameTable, int displayLevel){ + + if (!IS_CONSOLE(stdin)) { + DISPLAYOUT("zstd: --list does not support reading from standard input\n"); + return 1; + } + if (numFiles == 0) { DISPLAYOUT("No files given\n"); return 0; diff --git a/tests/playTests.sh b/tests/playTests.sh index 2a6e13a0..52d4dd0b 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -730,6 +730,9 @@ $ECHO "\n===> zstd --list/-l error detection tests " ! $ZSTD -lv tmp1* ! $ZSTD --list -v tmp2 tmp12.zst +$ECHO "\n===> zstd --list/-l exits 1 when stdin is piped in" +! echo "piped STDIN" | $ZSTD --list + $ECHO "\n===> zstd --list/-l test with null files " ./datagen -g0 > tmp5 $ZSTD tmp5