From f33c874a09dcfac90f008abeee9171d88431e212 Mon Sep 17 00:00:00 2001 From: Benjamin Radovsky Date: Sun, 27 Jan 2019 15:54:35 +1100 Subject: [PATCH] Fix keepalive being ignored on startcmd error on startup --- cmd/watcher/main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/watcher/main.go b/cmd/watcher/main.go index 2e7c5c3..5782bd1 100644 --- a/cmd/watcher/main.go +++ b/cmd/watcher/main.go @@ -156,10 +156,11 @@ func main() { c.Stdin = os.Stdin c.Stdout = os.Stdout c.Stderr = os.Stderr - err := c.Run() - if err != nil && *keepalive { - log.Println(err) - } else if err != nil { + if err := c.Run(); err != nil { + if (c.ProcessState == nil || !c.ProcessState.Success()) && *keepalive { + log.Println(err) + return + } log.Fatalln(err) } }