summaryrefslogtreecommitdiff
path: root/pipe_factory.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-11-09 14:21:21 +0300
committerValery Piashchynski <[email protected]>2020-11-09 14:21:21 +0300
commite3a1669c8168320318291325f70ca35e2ab2eec3 (patch)
treef14875ecb4a86805226812108efcab72898b6125 /pipe_factory.go
parent9fbe7726dd55cfedda724b7644e1b6bf7c1a6cb4 (diff)
New tests, remove errors.go
Diffstat (limited to 'pipe_factory.go')
-rwxr-xr-xpipe_factory.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/pipe_factory.go b/pipe_factory.go
index d6242775..9f85bf05 100755
--- a/pipe_factory.go
+++ b/pipe_factory.go
@@ -33,12 +33,13 @@ type SpawnResult struct {
// method Wait() must be handled on level above.
func (f *PipeFactory) SpawnWorkerWithContext(ctx context.Context, cmd *exec.Cmd) (WorkerBase, error) {
c := make(chan SpawnResult)
+ const op = errors.Op("spawn worker with context")
go func() {
w, err := InitBaseWorker(cmd)
if err != nil {
c <- SpawnResult{
w: nil,
- err: err,
+ err: errors.E(op, err),
}
return
}
@@ -48,7 +49,7 @@ func (f *PipeFactory) SpawnWorkerWithContext(ctx context.Context, cmd *exec.Cmd)
if err != nil {
c <- SpawnResult{
w: nil,
- err: err,
+ err: errors.E(op, err),
}
return
}
@@ -58,7 +59,7 @@ func (f *PipeFactory) SpawnWorkerWithContext(ctx context.Context, cmd *exec.Cmd)
if err != nil {
c <- SpawnResult{
w: nil,
- err: err,
+ err: errors.E(op, err),
}
return
}
@@ -72,7 +73,7 @@ func (f *PipeFactory) SpawnWorkerWithContext(ctx context.Context, cmd *exec.Cmd)
if err != nil {
c <- SpawnResult{
w: nil,
- err: errors.E(err, "process error"),
+ err: errors.E(op, err, "process error"),
}
return
}
@@ -87,7 +88,7 @@ func (f *PipeFactory) SpawnWorkerWithContext(ctx context.Context, cmd *exec.Cmd)
)
c <- SpawnResult{
w: nil,
- err: err,
+ err: errors.E(op, err),
}
return
}
@@ -117,19 +118,19 @@ func (f *PipeFactory) SpawnWorker(cmd *exec.Cmd) (WorkerBase, error) {
const op = errors.Op("spawn worker")
w, err := InitBaseWorker(cmd)
if err != nil {
- return nil, err
+ return nil, errors.E(op, err)
}
// TODO why out is in?
in, err := cmd.StdoutPipe()
if err != nil {
- return nil, err
+ return nil, errors.E(op, err)
}
// TODO why in is out?
out, err := cmd.StdinPipe()
if err != nil {
- return nil, err
+ return nil, errors.E(op, err)
}
// Init new PIPE relay