-
Notifications
You must be signed in to change notification settings - Fork 18k
os/exec: StdoutPipe example fails when run on golang.org #13693
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
Comments
What operating system are you using? |
I'm in Fedora 22 but to be clear this is the embedded example in the web page that fails, not me running anything locally. |
Ah, I see. Yes, none of the os/exec examples will actually work in the limited environment of the Go playground. We should try to document that somehow. |
I have a few ideas to help solve this
// Note: This example when run in the playground
// will fail because the playground is sandboxed/limited
// so shell utility lookups will fail. 2a) Easily detect when we are running on the playground like this import "runtime"
func execPathsUnavailable() bool {
// Shell lookups and utilities are
// unavailable on the playground running nacl
return runtime.GOOS == "nacl"
} 2b) A little more complex:
Please let me know what you think would be a better option. Thanks. |
os/exec is unavailable in nacl, we could just make
the error from os/exec better on nacl.
|
Could the 'run' button for the examples be removed or disabled? |
CL https://golang.org/cl/18035 mentions this issue. |
@stevekuznetsov, yes, that's probably the right answer. If we don't want to invent new annotation syntax, we could even just have a blacklist of code samples in hard-coded in cmd/godoc. If an example is on the blacklist then it'd get to Run button. |
We just need to blacklist the os/exec package to start with.
|
If you're running your own godoc then the example runs fine, right? |
CL https://golang.org/cl/18315 mentions this issue. |
On the official doc, the example under
func (*Cmd) StdoutPipe
fails with error:2009/11/10 23:00:00 exec: "echo": executable file not found in $PATH
when run.The text was updated successfully, but these errors were encountered: