Skip to content

Commit 5fea01b

Browse files
committed
Remove pipefail to be POSIX compatible
Fixes #11 By testing with dash it was possible to see `set -o pipefail` wont't work, it was removed and the critical code using pipe was split in two instructions.
1 parent 8c61207 commit 5fea01b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

php-fpm-healthcheck

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
# --slow-requests=n
3434
#
3535

36-
set -euo pipefail
36+
set -eu
3737

3838
OPTIND=1 # Reset getopt in case it has been used previously in the shell
3939

@@ -54,9 +54,9 @@ command -v grep 1> /dev/null || { >&2 echo "Make sure grep is installed (i.e. ap
5454
get_fpm_status() {
5555
if test "$VERBOSE" = 1; then printf "Trying to connect to php-fpm via: %s\\n" "$1"; fi;
5656

57-
if test ! -z "$FPM_STATUS"; then
58-
FPM_STATUS=$(cgi-fcgi -bind -connect "$1" | tail +5)
59-
fi;
57+
# Since I cannot use pipefail I'll just split these in two commands
58+
FPM_STATUS=$(cgi-fcgi -bind -connect "$1")
59+
FPM_STATUS=$(echo "$FPM_STATUS" | tail +5)
6060

6161
if test "$VERBOSE" = 1; then printf "php-fpm status output:\\n%s\\n" "$FPM_STATUS"; fi;
6262
}

0 commit comments

Comments
 (0)