Created
December 7, 2018 09:02
-
-
Save kazeburo/dbbdb8198c72addc2fcafbce79d5f6b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/starter.go b/starter.go | |
index c65ce00..4d47000 100644 | |
--- a/starter.go | |
+++ b/starter.go | |
@@ -517,7 +517,6 @@ func (s *Starter) StartWorker(sigCh chan os.Signal, ch chan processState) *os.Pr | |
sigs = append(sigs, sig) | |
} | |
} | |
- | |
// if received any signals, during the wait, we bail out | |
gotSig := false | |
if len(sigs) > 0 { | |
@@ -534,8 +533,10 @@ func (s *Starter) StartWorker(sigCh chan os.Signal, ch chan processState) *os.Pr | |
} | |
// Check if we can find a process by its pid | |
- p, err := os.FindProcess(pid) | |
- if gotSig || err == nil { | |
+ p, _ := os.FindProcess(pid) | |
+ var wstatus syscall.WaitStatus | |
+ waitpid, _ := syscall.Wait4(pid, &wstatus, syscall.WNOHANG, nil) | |
+ if gotSig || waitpid <= 0 { | |
// No error? We were successful! Make sure we capture | |
// the program exiting | |
go func() { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment