From 7e76671b114039d5004a8ef7394ef7b8ab0c3a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Bu=CC=88nemann?= Date: Wed, 13 Dec 2017 16:29:22 +0100 Subject: [PATCH] fix(nginx) wait for nginx reload to avoid zombies If a unix process is spawned, the parent process must wait for its pid or the process will become a zombie after exit. This fixes the problem that the "/opt/router/sbin/router" binary leaves behing a defunct nginx process each time the config is reloaded by spawning "nginx -s reload". --- nginx/commands.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nginx/commands.go b/nginx/commands.go index 89d3b97..2ff9761 100644 --- a/nginx/commands.go +++ b/nginx/commands.go @@ -32,6 +32,9 @@ func Reload() error { if err := cmd.Start(); err != nil { return err } + if err := cmd.Wait(); err != nil { + return err + } log.Println("INFO: nginx reloaded.") return nil }