From a221be676f0650993e76a9e402b93fa4ef7b5cf6 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Thu, 26 Apr 2018 16:51:53 -0400 Subject: [PATCH] Avoid dangling child procs in test suite. In go 1.10.1, these seem to make "go test" hang sometimes. https://github.com/golang/go/issues/24050 No issue # Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- sdk/go/arvadostest/run_servers.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sdk/go/arvadostest/run_servers.go b/sdk/go/arvadostest/run_servers.go index dcc2fb084e..490a7f3e03 100644 --- a/sdk/go/arvadostest/run_servers.go +++ b/sdk/go/arvadostest/run_servers.go @@ -104,7 +104,10 @@ func StopAPI() { defer os.Chdir(cwd) chdirToPythonTests() - bgRun(exec.Command("python", "run_test_server.py", "stop")) + cmd := exec.Command("python", "run_test_server.py", "stop") + bgRun(cmd) + // Without Wait, "go test" in go1.10.1 tends to hang. https://github.com/golang/go/issues/24050 + cmd.Wait() } // StartKeep starts the given number of keep servers, @@ -132,12 +135,9 @@ func StopKeep(numKeepServers int) { chdirToPythonTests() cmd := exec.Command("python", "run_test_server.py", "stop_keep", "--num-keep-servers", strconv.Itoa(numKeepServers)) - cmd.Stdin = nil - cmd.Stderr = os.Stderr - cmd.Stdout = os.Stderr - if err := cmd.Run(); err != nil { - log.Fatalf("%+v: %s", cmd.Args, err) - } + bgRun(cmd) + // Without Wait, "go test" in go1.10.1 tends to hang. https://github.com/golang/go/issues/24050 + cmd.Wait() } // Start cmd, with stderr and stdout redirected to our own -- 2.30.2