How to invoke child 'go' process in playground?

48 views
Skip to first unread message

Xiangdong JI

unread,
Oct 11, 2019, 11:33:54 PM10/11/19
to golang-nuts
Hi,

Given a command execution like "cmd := exec.CommandContext(ctx, "go", "run", file)" playground reports the following error:

child error: exec: "go": executable file not found in $PATH

Could it be solved by specifying a full path for 'go', which path shall I use? Thanks a lot.


Kurtis Rader

unread,
Oct 12, 2019, 12:09:52 AM10/12/19
to Xiangdong JI, golang-nuts
The Go playground does not allow running arbitrary external commands. No doubt primarily for security reasons. But also because the playground environment is not a complete virtualized OS. For example, try to execute

exec.Command("/bin/ls", "-la")

You'll get a "not implemented on nacl" error. See https://blog.golang.org/playground

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/30f33420-47d9-4fe7-8e39-980f8d5370db%40googlegroups.com.


--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

Xiangdong JI

unread,
Oct 12, 2019, 2:56:40 AM10/12/19
to golang-nuts
Thanks Kurtis.


On Saturday, October 12, 2019 at 12:09:52 PM UTC+8, Kurtis Rader wrote:
The Go playground does not allow running arbitrary external commands. No doubt primarily for security reasons. But also because the playground environment is not a complete virtualized OS. For example, try to execute

exec.Command("/bin/ls", "-la")

You'll get a "not implemented on nacl" error. See https://blog.golang.org/playground

On Fri, Oct 11, 2019 at 8:34 PM Xiangdong JI <xiang...@arm.com> wrote:
Hi,

Given a command execution like "cmd := exec.CommandContext(ctx, "go", "run", file)" playground reports the following error:

child error: exec: "go": executable file not found in $PATH

Could it be solved by specifying a full path for 'go', which path shall I use? Thanks a lot.


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages