Simply manage the start, stop and output of multiple processes through os/exec
func main() {
pm := gosup.NewManager()
defer pm.KillAll()
wd, _ := os.Getwd()
scriptPath := filepath.Join(wd, "test/run.py")
p1, err := pm.Start("python", []string{"-u", scriptPath}, nil, nil)
if err != nil {
fmt.Println(err)
return
}
time.Sleep(8 * time.Second)
pm.Stop(p1)
pm.WaitAll()
}
(Wait for completion)
(Wait for completion)