summaryrefslogtreecommitdiff
path: root/worker.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-01-23 20:13:47 -0500
committerWolfy-J <[email protected]>2018-01-23 20:13:47 -0500
commit116a7932b84ae9af65a5f7f667044c0cdf852fbc (patch)
tree426f7d96d7b9a6bfbf224eee65f1a6b5a787d541 /worker.go
parent13bd184e58ac0e47222c95f44f7e24976f66d4e3 (diff)
lock for stop
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() {