From bda9e51fef8d1fb5aa76e7185cd414eb893bb986 Mon Sep 17 00:00:00 2001 From: zeripath Date: Fri, 4 Sep 2020 19:59:19 +0100 Subject: [PATCH] Remove async pre-empt hack if go >= 1.15 (#12718) Signed-off-by: Andrew Thornton Co-authored-by: techknowlogick --- modules/git/command.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/git/command.go b/modules/git/command.go index 1496b0186..2a00a0a20 100644 --- a/modules/git/command.go +++ b/modules/git/command.go @@ -11,10 +11,12 @@ import ( "io" "os" "os/exec" + "runtime" "strings" "time" "code.gitea.io/gitea/modules/process" + "github.com/mcuadros/go-version" ) var ( @@ -130,7 +132,9 @@ func (c *Command) RunInDirTimeoutEnvFullPipelineFunc(env []string, timeout time. } // TODO: verify if this is still needed in golang 1.15 - cmd.Env = append(cmd.Env, "GODEBUG=asyncpreemptoff=1") + if version.Compare(runtime.Version(), "go1.15", "<") { + cmd.Env = append(cmd.Env, "GODEBUG=asyncpreemptoff=1") + } cmd.Dir = dir cmd.Stdout = stdout cmd.Stderr = stderr