summaryrefslogtreecommitdiff
path: root/worker.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-11-26 12:13:53 +0300
committerValery Piashchynski <[email protected]>2020-11-26 12:13:53 +0300
commit073683ebe27131cf8371decdfe309264b8ea2ad6 (patch)
tree4d5d7c114dbd1bda9a5b68f0fd1ee32b74de8906 /worker.go
parentb6ade6e91e58f14c874c450201b821a048d4950d (diff)
Truncate stderr before write, http_reset test config update
Diffstat (limited to 'worker.go')
-rwxr-xr-xworker.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/worker.go b/worker.go
index 4b9ef962..e2a4913e 100755
--- a/worker.go
+++ b/worker.go
@@ -232,7 +232,6 @@ func (w *WorkerProcess) Wait(ctx context.Context) error {
// if process return code > 0, here will be an error from stderr (if presents)
if w.stderr.Len() > 0 {
err = multierr.Append(err, errors.E(op, errors.Str(w.stderr.String())))
- w.stderr.Truncate(0)
}
return multierr.Append(err, w.closeRelay())
@@ -307,7 +306,10 @@ func (w *WorkerProcess) Kill() error {
func (w *WorkerProcess) Write(p []byte) (int, error) {
w.mu.Lock()
defer w.mu.Unlock()
+ // clean all previous messages in the stderr
+ w.stderr.Truncate(0)
w.events.Push(WorkerEvent{Event: EventWorkerLog, Worker: w, Payload: p})
+ // write new message
w.stderr.Write(p)
return len(p), nil