summaryrefslogtreecommitdiff
path: root/worker.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-05 23:28:18 +0300
committerWolfy-J <[email protected]>2018-06-05 23:28:18 +0300
commit28a5d8c3b6b7763e510617eeb8d483bfc6698b04 (patch)
tree50c897d4f2afef7fe96637ce1763084c588002f5 /worker.go
parent5c45a050ae211ae565cbc8903adda7900ab06577 (diff)
thread safe buffer for worker errors
Diffstat (limited to 'worker.go')
-rw-r--r--worker.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/worker.go b/worker.go
index 65088570..e33ea327 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 *buffer
+ err *errBuffer
// channel is being closed once command is complete.
waitDone chan interface{}
@@ -60,12 +60,12 @@ func newWorker(cmd *exec.Cmd) (*Worker, error) {
w := &Worker{
Created: time.Now(),
cmd: cmd,
- err: &buffer{buffer: new(bytes.Buffer)},
+ err: &errBuffer{buffer: new(bytes.Buffer)},
waitDone: make(chan interface{}),
state: newState(StateInactive),
}
- // piping all stderr to command buffer
+ // piping all stderr to command errBuffer
w.cmd.Stderr = w.err
return w, nil