summaryrefslogtreecommitdiff
path: root/worker.go
diff options
context:
space:
mode:
Diffstat (limited to 'worker.go')
-rw-r--r--worker.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/worker.go b/worker.go
index cb788030..8fbaa892 100644
--- a/worker.go
+++ b/worker.go
@@ -106,11 +106,11 @@ func (w *Worker) Start() error {
if w.waitDone != nil {
w.state.set(StateStopped)
- //w.mu.Lock()
- //defer w.mu.Unlock()
-
close(w.waitDone)
if w.rl != nil {
+ w.mu.Lock()
+ defer w.mu.Unlock()
+
w.rl.Close()
}
}
@@ -127,6 +127,9 @@ func (w *Worker) Wait() error {
<-w.waitDone
// ensure that all pipe descriptors are closed
+ w.mu.Lock()
+ defer w.mu.Unlock()
+
w.cmd.Wait()
if w.endState.Success() {