Skip to content

Commit 084270e

Browse files
committed
Review changes.
1 parent b52e899 commit 084270e

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/runtime/signal_windows_test.go

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"context"
99
"fmt"
1010
"internal/testenv"
11-
"io/ioutil"
1211
"net"
1312
"os"
1413
"os/exec"
@@ -86,21 +85,10 @@ func sendCtrlBreak(pid int) error {
8685
// TestCtrlHandler tests that Go can gracefully handle closing the console window.
8786
// See https://golang.org/issues/41884.
8887
func TestCtrlHandler(t *testing.T) {
89-
if *flagQuick {
90-
t.Skip("-quick")
91-
}
9288
testenv.MustHaveGoBuild(t)
93-
testenv.MustHaveExecPath(t, "gcc")
94-
testprog.Lock()
95-
defer testprog.Unlock()
96-
dir, err := ioutil.TempDir("", "go-build")
97-
if err != nil {
98-
t.Fatalf("failed to create temp directory: %v", err)
99-
}
100-
defer os.RemoveAll(dir)
10189

10290
// build go program
103-
exe := filepath.Join(dir, "test.exe")
91+
exe := filepath.Join(t.TempDir(), "test.exe")
10492
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", exe, "testdata/testwinsignal/main.go")
10593
out, err := testenv.CleanCmdEnv(cmd).CombinedOutput()
10694
if err != nil {
@@ -142,9 +130,8 @@ func TestCtrlHandler(t *testing.T) {
142130
if err != nil {
143131
t.Fatalf("ReadFrom failed: %v", err)
144132
}
145-
expected := syscall.SIGTERM.String()
146-
if string(data[:n]) != expected {
147-
t.Fatalf("Expected '%s' got: %s", expected, data[:n])
133+
if expected, got := syscall.SIGTERM.String(), string(data[:n]); expected != got {
134+
t.Fatalf("Expected '%s' got: %s", expected, got)
148135
}
149136

150137
if err := cmd.Wait(); err != nil {

0 commit comments

Comments
 (0)