test(harness): use SIGKILL to terminate daemons in Windows testing
Adin Schmahmann committed
Aug 31, 2023 at 01:47 UTC
fb5cacac86786597bd31d88867d5487ac0224b89
1 file changed
+10
test/cli/harness/node.go
+10
@@ -11,6 +11,7 @@ import (
11
"os"
12
"os/exec"
13
"path/filepath"
14
+ "runtime"
15
"strconv"
16
"strings"
17
"syscall"
@@ -278,6 +279,15 @@ func (n *Node) StopDaemon() *Node {
279
_, _ = n.Daemon.Cmd.Process.Wait()
280
watch <- struct{}{}
281
}()
282
+
283
+ // os.Interrupt does not support interrupts on Windows https://github.com/golang/go/issues/46345
284
+ if runtime.GOOS == "windows" {
285
+ if n.signalAndWait(watch, syscall.SIGKILL, 5*time.Second) {
286
+ return n
287
+ }
288
+ log.Panicf("timed out stopping node %d with peer ID %s", n.ID, n.PeerID())
289
+ }
290
+
291
log.Debugf("signaling node %d with SIGTERM", n.ID)
292
if n.signalAndWait(watch, syscall.SIGTERM, 1*time.Second) {
293
return n