Skip to content

Commit 9964904

Browse files
committed
fix(command): Restore environment variables before calling exec
1 parent 526918b commit 9964904

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

wait-for

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/sh
22

3+
set -- "$@" -- "$TIMEOUT" "$QUIET" "$HOST" "$PORT" "$result"
34
TIMEOUT=15
45
QUIET=0
56

@@ -30,7 +31,15 @@ wait_for() {
3031

3132
result=$?
3233
if [ $result -eq 0 ] ; then
33-
if [ $# -gt 0 ] ; then
34+
if [ $# -gt 6 ] ; then
35+
for result in $(seq $(($# - 6))); do
36+
result=$1
37+
shift
38+
set -- "$@" "$result"
39+
done
40+
41+
TIMEOUT=$2 QUIET=$3 HOST=$4 PORT=$5 result=$6
42+
shift 6
3443
exec "$@"
3544
fi
3645
exit 0
@@ -47,8 +56,7 @@ wait_for() {
4756
exit 1
4857
}
4958

50-
while [ $# -gt 0 ]
51-
do
59+
while :; do
5260
case "$1" in
5361
*:* )
5462
HOST=$(printf "%s\n" "$1"| cut -d : -f 1)

0 commit comments

Comments
 (0)