Forking in "go test"

574 views
Skip to first unread message

Christopher Lenart

unread,
Jun 12, 2014, 7:21:34 PM6/12/14
to golan...@googlegroups.com
I am writing a library to start and manage child processes within a go program.

When attempting to test this with "go test", I always get fork/exec, permission denied error. If i modify the tests to be called from a main function as part of a main package and run it as a standalone program, it works just fine.

Does the go test program not allow forking? Do I have something configured wrong?

I am using the os/exec package, Run() in particular.

Christopher Lenart

unread,
Jun 12, 2014, 7:28:37 PM6/12/14
to golan...@googlegroups.com
Update: I discovered that it will work, when the executable file being forked into is in the same directory as the go test.

That is an annoying restriction though.. 

Ian Lance Taylor

unread,
Jun 12, 2014, 7:43:52 PM6/12/14
to Christopher Lenart, golang-nuts
I don't know if this is the issue, but note that using go test runs
the test program in a different, temporary, directory.

Ian

Dave Cheney

unread,
Jun 12, 2014, 10:31:35 PM6/12/14
to golan...@googlegroups.com
Is your /tmp mounted with the noexec flag ?
Reply all
Reply to author
Forward
0 new messages