diff options
author | Wolfy-J <[email protected]> | 2018-01-23 20:13:47 -0500 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-01-23 20:13:47 -0500 |
commit | 116a7932b84ae9af65a5f7f667044c0cdf852fbc (patch) | |
tree | 426f7d96d7b9a6bfbf224eee65f1a6b5a787d541 /worker.go | |
parent | 13bd184e58ac0e47222c95f44f7e24976f66d4e3 (diff) |
lock for stop
Diffstat (limited to 'worker.go')
-rw-r--r-- | worker.go | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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() { |