From: Roland Shoemaker Date: Tue, 19 Jan 2021 17:59:24 +0000 (-0800) Subject: cmd/go: overwrite program name with full path X-Git-Tag: go1.16rc1~47 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3c2f11ba5b76cda35a5bedc9299833c649216b83;p=gostls13.git cmd/go: overwrite program name with full path If the program path is resolved, replace the first argument of the exec.Cmd, which is the bare program name with the resolved path. Change-Id: I92cf5e6f4bb7c8fef9b59f5eab963f4e75b90d07 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/957908 Reviewed-by: Katie Hockman Reviewed-by: Russ Cox Reviewed-by: Jay Conrod Reviewed-on: https://go-review.googlesource.com/c/go/+/284784 Trust: Roland Shoemaker Reviewed-by: Ian Lance Taylor Run-TryBot: Roland Shoemaker --- diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index 16a4ebaa0f..cacb4c05df 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -2042,6 +2042,9 @@ func (b *Builder) runOut(a *Action, dir string, env []string, cmdargs ...interfa var buf bytes.Buffer cmd := exec.Command(cmdline[0], cmdline[1:]...) + if cmd.Path != "" { + cmd.Args[0] = cmd.Path + } cmd.Stdout = &buf cmd.Stderr = &buf cleanup := passLongArgsInResponseFiles(cmd)