Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

fix error on AppVeyor #157

Merged
merged 1 commit into from
Jan 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions dep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ import (
"regexp"
"runtime"
"strings"
"sync"
"testing"
)

var (
exeSuffix string // ".exe" on Windows
mu sync.Mutex
)

func init() {
Expand Down Expand Up @@ -197,6 +199,10 @@ func (tg *testgoData) doRun(args []string) error {

// run runs the test go command, and expects it to succeed.
func (tg *testgoData) run(args ...string) {
if runtime.GOOS == "windows" {
mu.Lock()
defer mu.Unlock()
}
if status := tg.doRun(args); status != nil {
tg.t.Logf("go %v failed unexpectedly: %v", args, status)
tg.t.FailNow()
Expand Down Expand Up @@ -479,6 +485,13 @@ func (tg *testgoData) cleanup() {
os.Exit(2)
}
}
// NOTE(mattn): It seems that sometimes git.exe is not dead
// when cleanup() is called. But we do not know any way to wait for it.
if runtime.GOOS == "windows" {
mu.Lock()
exec.Command(`taskkill`, `/F`, `/IM`, `git.exe`).Run()
mu.Unlock()
}
for _, path := range tg.temps {
tg.check(os.RemoveAll(path))
}
Expand Down