summaryrefslogtreecommitdiff
path: root/pipe_factory.go
diff options
context:
space:
mode:
Diffstat (limited to 'pipe_factory.go')
-rw-r--r--pipe_factory.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/pipe_factory.go b/pipe_factory.go
index d6fe0420..d8243d28 100644
--- a/pipe_factory.go
+++ b/pipe_factory.go
@@ -1,6 +1,7 @@
package roadrunner
import (
+ "fmt"
"github.com/pkg/errors"
"github.com/spiral/goridge"
"io"
@@ -45,11 +46,20 @@ func (f *PipeFactory) SpawnWorker(cmd *exec.Cmd) (w *Worker, err error) {
}
if pid, err := fetchPID(w.rl); pid != *w.Pid {
- go func(w *Worker) { w.Kill() }(w)
+ go func(w *Worker) {
+ err := w.Kill()
+ if err != nil {
+ // there is no logger here, how to handle error in goroutines ?
+ fmt.Println(fmt.Sprintf("error killing the worker with PID number %d, Created: %s", w.Pid, w.Created))
+ }
+ }(w)
if wErr := w.Wait(); wErr != nil {
if _, ok := wErr.(*exec.ExitError); ok {
- err = errors.Wrap(wErr, err.Error())
+ // error might be nil here
+ if err != nil {
+ err = errors.Wrap(wErr, err.Error())
+ }
} else {
err = wErr
}