summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2019-11-30 22:47:16 +0300
committerValery Piashchynski <[email protected]>2019-11-30 22:47:16 +0300
commit4c608506dd745a73b5e09348485e48288824b774 (patch)
tree448040cb78f91971259a54654f640e90428ef9a2
parente8d7453da6a2f29bea56a606e42c18422eb014b0 (diff)
- Updated worker, add different wait mechanism
-rw-r--r--worker.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/worker.go b/worker.go
index 6be841a9..58899e41 100644
--- a/worker.go
+++ b/worker.go
@@ -10,6 +10,7 @@ import (
"strconv"
"strings"
"sync"
+ "syscall"
"time"
)
@@ -105,8 +106,13 @@ func (w *Worker) Wait() error {
if runtime.GOOS != "windows" {
// windows handles processes and close pipes differently,
// we can ignore wait here as process.Wait() already being handled above
- err := w.cmd.Wait()
+ var ws syscall.WaitStatus
+ _, err := syscall.Wait4(w.cmd.Process.Pid, &ws, syscall.WALL, nil)
if err != nil {
+ if ws.Exited() {
+ return nil
+ }
+ } else {
return err
}
}