🐛 fix: windows 杀子进程

This commit is contained in:
naiba
2021-01-29 14:29:31 +08:00
parent b5a0b0ff16
commit 52d9a4597b
6 changed files with 34 additions and 48 deletions

View File

@@ -84,14 +84,15 @@ func cmdExec() {
panic(err)
}
if utils.IsWindows() {
cmd = exec.Command("cmd", "/c", execFrom+"/cmd/playground/example.sh hello asd")
cmd = exec.Command("cmd", "/c", os.Args[1])
// cmd = exec.Command("cmd", "/c", execFrom+"/cmd/playground/example.sh hello asd")
} else {
cmd = exec.Command("sh", "-c", execFrom+`/cmd/playground/example.sh hello && \
echo world!`)
}
pg.AddProcess(cmd)
go func() {
time.Sleep(time.Second * 2)
time.Sleep(time.Second * 10)
if err = pg.Dispose(); err != nil {
panic(err)
}