summaryrefslogtreecommitdiff
path: root/pipe_factory.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-11-09 14:26:32 +0300
committerValery Piashchynski <[email protected]>2020-11-09 14:26:32 +0300
commitb7b533dbe13d2c1a8e78c0e33a4a388c56884440 (patch)
treed915b68d0394e249ead23501f5a043e256115c5f /pipe_factory.go
parente3a1669c8168320318291325f70ca35e2ab2eec3 (diff)
CI update
Diffstat (limited to 'pipe_factory.go')
-rwxr-xr-xpipe_factory.go27
1 files changed, 7 insertions, 20 deletions
diff --git a/pipe_factory.go b/pipe_factory.go
index 9f85bf05..15f38e42 100755
--- a/pipe_factory.go
+++ b/pipe_factory.go
@@ -2,9 +2,7 @@ package roadrunner
import (
"context"
- "fmt"
"os/exec"
- "strings"
"github.com/spiral/errors"
"github.com/spiral/goridge/v2"
@@ -144,24 +142,13 @@ func (f *PipeFactory) SpawnWorker(cmd *exec.Cmd) (WorkerBase, error) {
}
// errors bundle
- var errs []string
- if pid, errF := fetchPID(relay); pid != w.Pid() {
- if errF != nil {
- errs = append(errs, errF.Error())
- }
-
- errK := w.Kill()
- if errK != nil {
- errs = append(errs, fmt.Errorf("error killing the worker with PID number %d, Created: %s", w.Pid(), w.Created()).Error())
- }
-
- if wErr := w.Wait(context.Background()); wErr != nil {
- errs = append(errs, wErr.Error())
- }
-
- if len(errs) > 0 {
- return nil, errors.E(op, strings.Join(errs, "/"))
- }
+ if pid, err := fetchPID(relay); pid != w.Pid() {
+ err = multierr.Combine(
+ err,
+ w.Kill(),
+ w.Wait(context.Background()),
+ )
+ return nil, errors.E(op, err)
}
// everything ok, set ready state