2 ms·
1. No if you don't call wait on child. Make sure to collect the status though in case if child has crashed for some reason otherwise you will end up with zombie
by alexk 12y ago
1. No if you don't call wait on child. Make sure to collect the status though in case if child has crashed for some reason otherwise you will end up with zombie:
syscall.Wait4(-1, &wait, syscall.WNOHANG, nil)
I would also recommend to use a higer level StartProcess instead
2. You can pass any arguments when starting a child, or even execute completely different binary:
p, err := os.StartProcess(path, os.Args, &os.ProcAttr{
Dir: wd,
Env: os.Environ(),
Files: files,
Sys: &syscall.SysProcAttr{},
})