Skip to content

Commit 6631f53

Browse files
committed
.
1 parent 1981696 commit 6631f53

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

process/interrupt_windows_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@ package process
55
import (
66
"os"
77
"os/exec"
8+
"syscall"
89
"testing"
910
)
1011

1112
func TestSendInterrupt(t *testing.T) {
12-
// Re-exec the test in a child process so the CTRL_BREAK_EVENT does not
13-
// propagate to sibling processes (e.g. the Go compiler running in
14-
// parallel during "go test ./...").
13+
// Re-exec in a child with its own process group so the CTRL_BREAK_EVENT
14+
// stays isolated and does not kill sibling processes (e.g. the Go
15+
// compiler running in parallel during "go test ./...").
1516
if os.Getenv("TEST_SEND_INTERRUPT_CHILD") == "1" {
1617
SendInterrupt()
1718
return
1819
}
1920

2021
cmd := exec.Command(os.Args[0], "-test.run=^TestSendInterrupt$")
2122
cmd.Env = append(os.Environ(), "TEST_SEND_INTERRUPT_CHILD=1")
23+
cmd.SysProcAttr = &syscall.SysProcAttr{CreationFlags: syscall.CREATE_NEW_PROCESS_GROUP}
2224
out, err := cmd.CombinedOutput()
2325
if err != nil {
2426
t.Fatalf("child process failed: %v\n%s", err, out)

0 commit comments

Comments
 (0)