refactor: set pipefail conditionally
This commit is contained in:
parent
e6c003bdec
commit
e9f7ed696e
|
@ -1,9 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
if ! (set -o pipefail 2>/dev/null); then
|
||||||
# dash does not support pipefail
|
# 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
|
|
||||||
set -efx
|
set -efx
|
||||||
else
|
else
|
||||||
set -efx -o pipefail
|
set -efx -o pipefail
|
||||||
|
|
Loading…
Reference in New Issue