Skip to content

Commit 61f3dd4

Browse files
committed
Acquire getopt without changing shell option
1 parent aa0ec2c commit 61f3dd4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

php-fpm-healthcheck

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,14 @@ check_fpm_health() {
103103
done
104104
}
105105

106-
set +e
106+
if ! GETOPT=$(getopt -o v --long verbose,accepted-conn:,listen-queue-len:,active-processes:,slow-requests: -n 'php-fpm-healthcheck' -- "$@"); then
107+
>&2 echo "Invalid options, terminating." ; exit 3
108+
fi;
107109

108-
GETOPT=$(getopt -o v --long verbose,accepted-conn:,listen-queue-len:,active-processes:,slow-requests: -n 'php-fpm-healthcheck' -- "$@")
109-
110-
if test "$?" != 0; then >&2 echo "Invalid options, terminating." ; exit 3 ; fi
111-
112-
set -e
110+
eval set -- "$GETOPT"
113111

114112
FCGI_CONNECT="${FCGI_CONNECT:-$FCGI_CONNECT_DEFAULT}"
115113

116-
eval set -- "$GETOPT"
117-
118114
VERBOSE=0
119115

120116
while test "$1"; do

0 commit comments

Comments
 (0)