I'm using TinyGo to build for an ARM-based Linux system that has limited resources. I'm trying to invoke a few other processes from my program, e.g. killall:
exec.Command("killall", "someproc").Start()
However, this results in a bunch of errors (Process not declared by package os) and indeed os/exec isn't supported by TinyGo.
Is there a way to invoke shell commands from Go without using os/exec? My first thought was to use Cgo, but this also doesn't seem to work with TinyGo:
// #include <unistd.h>
import "C"
func main() {
C.fork()
// exec etc.
}
While it works fine Go, I'm getting a linker error when using TinyGo (error: undefined symbol: fork). Is there a library that I need to link to get fork() and other system calls? Is there any alternative way to simply invoke a shell command from Go?