diff options
Diffstat (limited to 'pkg')
-rwxr-xr-x | pkg/worker/worker.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/worker/worker.go b/pkg/worker/worker.go index aef7f2b0..bf70d646 100755 --- a/pkg/worker/worker.go +++ b/pkg/worker/worker.go @@ -79,6 +79,7 @@ type Process struct { // InitBaseWorker creates new Process over given exec.cmd. func InitBaseWorker(cmd *exec.Cmd, options ...Options) (worker.BaseProcess, error) { + const op = errors.Op("init_base_worker") if cmd.Process != nil { return nil, fmt.Errorf("can't attach to running process") } @@ -224,6 +225,8 @@ func (w *Process) Wait() error { w.state.Set(internal.StateStopped) } + w.stderr.Reset() + return nil } @@ -305,6 +308,8 @@ func (w *Process) watch() { n, _ := w.rd.Read(*buf) w.events.Push(events.WorkerEvent{Event: events.EventWorkerLog, Worker: w, Payload: (*buf)[:n]}) w.mu.Lock() + // delete all prev messages + w.stderr.Reset() // write new message w.stderr.Write((*buf)[:n]) w.mu.Unlock() |