mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-05 21:20:06 +00:00
🐛 fix: windows 杀子进程
This commit is contained in:
@@ -251,9 +251,10 @@ func doTask(task *pb.Task) {
|
||||
select {
|
||||
case <-timeout.C:
|
||||
result.Data = "任务执行超时\n"
|
||||
pg.Dispose()
|
||||
close(endCh)
|
||||
pg.Dispose()
|
||||
case <-endCh:
|
||||
timeout.Stop()
|
||||
}
|
||||
}()
|
||||
output, err := cmd.Output()
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user