diff options
author | Valery Piashchynski <[email protected]> | 2020-12-22 23:02:25 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-12-22 23:02:25 +0300 |
commit | fd1e98bc6339abfa66523bf9d2208d00df8ee4bc (patch) | |
tree | b679441276717e687a5b460ebeba7ad0eee69be9 /pkg/pipe/pipe_factory_test.go | |
parent | 40b6c3169931a3fef62b649db19ff01dc685b7d4 (diff) |
events listeners refactor, CLI initial commit
Diffstat (limited to 'pkg/pipe/pipe_factory_test.go')
-rwxr-xr-x | pkg/pipe/pipe_factory_test.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/pkg/pipe/pipe_factory_test.go b/pkg/pipe/pipe_factory_test.go index 0d548b7a..3cef0646 100755 --- a/pkg/pipe/pipe_factory_test.go +++ b/pkg/pipe/pipe_factory_test.go @@ -405,21 +405,20 @@ func Test_Echo_Slow(t *testing.T) { func Test_Broken(t *testing.T) { ctx := context.Background() cmd := exec.Command("php", "../../tests/client.php", "broken", "pipes") - - w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) - if err != nil { - t.Fatal(err) - } - data := "" mu := &sync.Mutex{} - w.AddListener(func(event interface{}) { + listener := func(event interface{}) { if wev, ok := event.(events.WorkerEvent); ok { mu.Lock() data = string(wev.Payload.([]byte)) mu.Unlock() } - }) + } + + w, err := NewPipeFactory(listener).SpawnWorkerWithTimeout(ctx, cmd) + if err != nil { + t.Fatal(err) + } syncWorker, err := workerImpl.From(w) if err != nil { |