Skip to content

Commit 3c2f11b

Browse files
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 <[email protected]> Reviewed-by: Russ Cox <[email protected]> Reviewed-by: Jay Conrod <[email protected]> Reviewed-on: https://go-review.googlesource.com/c/go/+/284784 Trust: Roland Shoemaker <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Roland Shoemaker <[email protected]>
1 parent 953d1fe commit 3c2f11b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/cmd/go/internal/work/exec.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,6 +2042,9 @@ func (b *Builder) runOut(a *Action, dir string, env []string, cmdargs ...interfa
20422042

20432043
var buf bytes.Buffer
20442044
cmd := exec.Command(cmdline[0], cmdline[1:]...)
2045+
if cmd.Path != "" {
2046+
cmd.Args[0] = cmd.Path
2047+
}
20452048
cmd.Stdout = &buf
20462049
cmd.Stderr = &buf
20472050
cleanup := passLongArgsInResponseFiles(cmd)

0 commit comments

Comments
 (0)