lntest+itest: kill node and wait its process

Fix a flake found in `testRPCMiddlewareInterceptor` when running in
macOS.
This commit is contained in:
yyforyongyu committed 2024-11-12 23:55:40 +08:00
1 parent 90bca1022b
commit 2905e7b3df
3 files changed
+21 -9

No files matched your search

+12
View File
@@ -796,6 +796,18 @@ func (hn *HarnessNode) Kill() error {
return hn.cmd.Process.Kill()
}
// KillAndWait kills the lnd process and waits for it to finish.
func (hn *HarnessNode) KillAndWait() error {
err := hn.cmd.Process.Kill()
if err != nil {
return err
}
_, err = hn.cmd.Process.Wait()
return err
}
// printErrf prints an error to the console.
func (hn *HarnessNode) printErrf(format string, a ...interface{}) {
fmt.Printf("itest error from [%s:%s]: %s\n", //nolint:forbidigo