commit | 3c2f11ba5b76cda35a5bedc9299833c649216b83 | [log] [tgz] |
---|---|---|
author | Roland Shoemaker <roland@golang.org> | Tue Jan 19 09:59:24 2021 -0800 |
committer | Roland Shoemaker <roland@golang.org> | Thu Jan 21 19:15:21 2021 +0000 |
tree | d0574aece810f0ac2815c6af669dcedc9c6f94cd | |
parent | 953d1feca9b21af075ad5fc8a3dad096d3ccc3a0 [diff] |
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 <katiehockman@google.com> Reviewed-by: Russ Cox <rsc@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/284784 Trust: Roland Shoemaker <roland@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Roland Shoemaker <roland@golang.org>
diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index 16a4eba..cacb4c0 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go
@@ -2042,6 +2042,9 @@ 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)