Skip to content

Commit 3b37c8d

Browse files
baracodertimoreimann
authored andcommitted
Make sure timeout monitor trap works in non-interactive environment (#9)
1 parent 4851d6b commit 3b37c8d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

wait-for-deployment

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
set -o errexit
1212
set -o pipefail
1313
set -o nounset
14+
# -m enables job control which is otherwise only enabled in interactive mode
15+
# http://unix.stackexchange.com/a/196606/73578
16+
set -m
1417

1518
DEFAULT_TIMEOUT=60
1619

@@ -67,7 +70,7 @@ echo "Waiting for deployment with timeout ${timeout} seconds"
6770
monitor_timeout $$ &
6871
readonly timeout_monitor_pid=$!
6972

70-
trap 'kill ${timeout_monitor_pid}' EXIT #Stop timeout monitor
73+
trap 'kill -- -${timeout_monitor_pid}' EXIT #Stop timeout monitor
7174

7275
generation=$(get_generation); readonly generation
7376
current_generation=$(get_observed_generation)

0 commit comments

Comments
 (0)