From e45a4fda4facc67ca30e6e528fc0a2076220682c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rg-Volker=20Peetz?= Date: Mon, 1 Feb 2021 19:36:53 +0000 Subject: [PATCH] Fix zstdgrep exit code when operating on files Forwarded: https://github.com/facebook/zstd/issues/1428 Gbp-Pq: Name 0016-fix-zstdgrep-exit-code.patch --- programs/zstdgrep | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/programs/zstdgrep b/programs/zstdgrep index a10e071..57a6abe 100755 --- a/programs/zstdgrep +++ b/programs/zstdgrep @@ -113,16 +113,11 @@ else if [ "${silent}" -lt 1 ] && [ "$#" -gt 1 ]; then grep_args="-H ${grep_args}" fi - CUR_EXIT_CODE=0 - EXIT_CODE=1 set -f while [ "$#" -gt 0 ]; do # shellcheck disable=SC2086 "${zcat}" -fq -- "$1" | "${grep}" --label="${1}" ${grep_args} -- "${pattern}" - - CUR_EXIT_CODE=$? - if [ "${CUR_EXIT_CODE}" -eq 0 ] && [ "${EXIT_CODE}" -ne 1 ]; then - EXIT_CODE=0 - fi + [ "$?" -ne 0 ] && EXIT_CODE=1 shift done set +f -- 2.30.2