-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: go build
(etc.) doesn't work with symlinks when invoked via os/exec.Command with mismatched PWD
#63644
Comments
Though maybe I'm missing something. |
go build
(etc.) doesn't work with symlinksgo build
(etc.) doesn't work with symlinks when invoked via os/exec.Command
This is as expected given #50599 (see the “Limitations” section of that proposal). Because you have explicitly set When the program invokes The The fix is for your program to make use of #50599 to set cmd := exec.Command("go", "run", src)
cmd.Dir = src
cmd.Env = cmd.Environ() // Call after setting cmd.Dir to get the correct PWD.
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr |
go build
(etc.) doesn't work with symlinks when invoked via os/exec.Commandgo build
(etc.) doesn't work with symlinks when invoked via os/exec.Command with mismatched PWD
That's very illuminating—thank you for shining a light on it. Hopefully anyone else who trips themselves up over this can find this thread. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
followed by
What did you expect to see?
I would expect the last command to print out "Hello, world!".
What did you see instead?
The text was updated successfully, but these errors were encountered: