From 610f42ad5a032bc37ddef0a616f2aabb173e5fd5 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 16 Apr 2017 15:24:48 -0700 Subject: [PATCH] test: avoid double chan close in integration testing framework --- networktest.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/networktest.go b/networktest.go index ff2d18c6..9a7b151d 100644 --- a/networktest.go +++ b/networktest.go @@ -271,19 +271,19 @@ func (l *lightningNode) Stop() error { // - start of the node wasn't initiated // - process wasn't spawned // - process already finished - select { + case <-l.quit: + return nil case <-l.processExit: return nil default: - close(l.quit) - l.wg.Wait() - - if runtime.GOOS == "windows" { - return l.cmd.Process.Signal(os.Kill) - } - return l.cmd.Process.Signal(os.Interrupt) } + + close(l.quit) + if runtime.GOOS == "windows" { + return l.cmd.Process.Signal(os.Kill) + } + return l.cmd.Process.Signal(os.Interrupt) } // Restart attempts to restart a lightning node by shutting it down cleanly,