summaryrefslogtreecommitdiff
path: root/worker.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-05 23:25:00 +0300
committerWolfy-J <[email protected]>2018-06-05 23:25:00 +0300
commit5c45a050ae211ae565cbc8903adda7900ab06577 (patch)
tree6396d4bea39a7186ac50705de8a83bd557fb3809 /worker.go
parentc08c5c0e3d09a8ceec59dc4e9d48884de45096b4 (diff)
thread safe buffer for worker errors
Diffstat (limited to 'worker.go')
-rw-r--r--worker.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/worker.go b/worker.go
index 5db5ed82..65088570 100644
--- a/worker.go
+++ b/worker.go
@@ -36,7 +36,7 @@ type Worker struct {
// err aggregates stderr output from underlying process. Value can be
// receive only once command is completed and all pipes are closed.
- err *bytes.Buffer
+ err *buffer
// channel is being closed once command is complete.
waitDone chan interface{}
@@ -60,7 +60,7 @@ func newWorker(cmd *exec.Cmd) (*Worker, error) {
w := &Worker{
Created: time.Now(),
cmd: cmd,
- err: new(bytes.Buffer),
+ err: &buffer{buffer: new(bytes.Buffer)},
waitDone: make(chan interface{}),
state: newState(StateInactive),
}