Ensure process is stopped before detaching in tests

This commit is contained in:
Derek Parker 2015-06-24 09:44:24 -05:00
parent b35a743a3c
commit 72b81c0c6b
2 changed files with 8 additions and 2 deletions

@ -26,7 +26,10 @@ func withTestProcess(name string, t *testing.T, fn func(p *Process, fixture prot
t.Fatal("Launch():", err)
}
defer p.Detach(true)
defer func() {
p.Halt()
p.Detach(true)
}()
fn(p, fixture)
}

@ -35,7 +35,10 @@ func withTestClient(name string, t *testing.T, fn func(c service.Client)) {
}, false)
go server.Run()
client := rpc.NewClient(listener.Addr().String())
defer client.Detach(true)
defer func() {
client.Detach(true)
}()
fn(client)
}