Skip to content

Commit 97866b5

Browse files
committed
Simplify nc usage
Using -k keeps the process listening after the command
1 parent e73609f commit 97866b5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

docker-lifecycle-listener.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,10 @@ main() {
173173
trap 'cleanup; log Stopped; exit 0' HUP INT TERM
174174

175175
log "Listening for commands on port $port"
176-
while :; do
177-
while read -r command; do
178-
run_command "$command"
179-
done < <(nc -l "$port")
180-
done
176+
177+
while read -r command; do
178+
run_command "$command"
179+
done < <(nc -kl "$port")
181180

182181
log 'Exiting'
183182
}

0 commit comments

Comments
 (0)