diff --git a/ctl_test.go b/ctl_test.go index 7713c7e..53dee1b 100644 --- a/ctl_test.go +++ b/ctl_test.go @@ -56,9 +56,14 @@ func TestCtl(t *testing.T) { cconn, sconn := net.Pipe() clientctl := ctl{conn: cconn, log: pkglog} serverctl := ctl{conn: sconn, log: pkglog} - go servectlcmd(ctxbg, &serverctl, func() {}) + done := make(chan struct{}) + go func() { + servectlcmd(ctxbg, &serverctl, func() {}) + close(done) + }() fn(&clientctl) cconn.Close() + <-done sconn.Close() }