зеркало из https://github.com/golang/build.git
go.tools/dashboard/builder: skip "path" environment variable on windows
"PATH" and "path" are one and the same environment variable on windows. We set PATH variable, while "path" is set to its original value. Windows might use either for the sub-process. LGTM=adg R=golang-codereviews, adg CC=golang-codereviews https://golang.org/cl/109980043
This commit is contained in:
Родитель
2bb70ddaa2
Коммит
e4931a8fce
|
@ -16,25 +16,6 @@ import (
|
|||
"code.google.com/p/go.tools/go/vcs"
|
||||
)
|
||||
|
||||
// These variables are copied from the gobuilder's environment
|
||||
// to the envv of its subprocesses.
|
||||
var extraEnv = []string{
|
||||
"GOARM",
|
||||
"GO386",
|
||||
"CGO_ENABLED",
|
||||
|
||||
// For Unix derivatives.
|
||||
"CC",
|
||||
"PATH",
|
||||
"TMPDIR",
|
||||
"USER",
|
||||
|
||||
// For Plan 9.
|
||||
"objtype",
|
||||
"cputype",
|
||||
"path",
|
||||
}
|
||||
|
||||
// builderEnv represents the environment that a Builder will run tests in.
|
||||
type builderEnv interface {
|
||||
// setup sets up the builder environment and returns the directory to run the buildCmd in.
|
||||
|
@ -71,7 +52,7 @@ func (b *Builder) envv() []string {
|
|||
}
|
||||
}
|
||||
|
||||
for _, k := range extraEnv {
|
||||
for _, k := range extraEnv() {
|
||||
if s, ok := getenvOk(k); ok {
|
||||
e = append(e, k+"="+s)
|
||||
}
|
||||
|
@ -92,7 +73,7 @@ func (b *Builder) envvWindows() []string {
|
|||
}
|
||||
}
|
||||
|
||||
for _, name := range extraEnv {
|
||||
for _, name := range extraEnv() {
|
||||
if s, ok := getenvOk(name); ok {
|
||||
start[name] = s
|
||||
}
|
||||
|
@ -276,3 +257,21 @@ func getenvOk(k string) (v string, ok bool) {
|
|||
}
|
||||
return "", false
|
||||
}
|
||||
|
||||
// extraEnv returns environment variables that need to be copied from
|
||||
// the gobuilder's environment to the envv of its subprocesses.
|
||||
func extraEnv() []string {
|
||||
extra := []string{
|
||||
"GOARM",
|
||||
"GO386",
|
||||
"CGO_ENABLED",
|
||||
"CC",
|
||||
"PATH",
|
||||
"TMPDIR",
|
||||
"USER",
|
||||
}
|
||||
if runtime.GOOS == "plan9" {
|
||||
extra = append(extra, "objtype", "cputype", "path")
|
||||
}
|
||||
return extra
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче