From bffec4485d5046ebce673dc1baf5f390639b8946 Mon Sep 17 00:00:00 2001 From: MDLeom <2809763-curben@users.noreply.gitlab.com> Date: Mon, 15 Jul 2024 08:02:11 +0000 Subject: [PATCH] refactor: set pipefail conditionally --- src/script.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/script.sh b/src/script.sh index 22d5567..8b4b554 100644 --- a/src/script.sh +++ b/src/script.sh @@ -2,10 +2,8 @@ #!/bin/sh -# dash does not support pipefail -# this does not work in `dash script.sh` -IS_DASH=$(readlink -f "/bin/sh" | grep "dash" || [ $? = 1 ]) -if [ -n "$IS_DASH" ]; then +if ! (set -o pipefail 2>/dev/null); then + # dash does not support pipefail set -efx else set -efx -o pipefail