This repository was archived by the owner on Sep 9, 2020. It is now read-only.
File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,13 @@ import (
15
15
"regexp"
16
16
"runtime"
17
17
"strings"
18
+ "sync"
18
19
"testing"
19
20
)
20
21
21
22
var (
22
23
exeSuffix string // ".exe" on Windows
24
+ mu sync.Mutex
23
25
)
24
26
25
27
func init () {
@@ -197,6 +199,10 @@ func (tg *testgoData) doRun(args []string) error {
197
199
198
200
// run runs the test go command, and expects it to succeed.
199
201
func (tg * testgoData ) run (args ... string ) {
202
+ if runtime .GOOS == "windows" {
203
+ mu .Lock ()
204
+ defer mu .Unlock ()
205
+ }
200
206
if status := tg .doRun (args ); status != nil {
201
207
tg .t .Logf ("go %v failed unexpectedly: %v" , args , status )
202
208
tg .t .FailNow ()
@@ -472,6 +478,13 @@ func (tg *testgoData) mustNotExist(path string) {
472
478
473
479
// cleanup cleans up a test that runs testgo.
474
480
func (tg * testgoData ) cleanup () {
481
+ // NOTE(mattn): It seems that sometimes git.exe is not dead
482
+ // when cleanup() is called. But we do not know any way to wait for it.
483
+ if runtime .GOOS == "windows" {
484
+ mu .Lock ()
485
+ exec .Command (`taskkill` , `/F` , `/IM` , `git.exe` ).Run ()
486
+ mu .Unlock ()
487
+ }
475
488
if tg .wd != "" {
476
489
if err := os .Chdir (tg .wd ); err != nil {
477
490
// We are unlikely to be able to continue.
You can’t perform that action at this time.
0 commit comments