优化 去除无效的输出

This commit is contained in:
dengsgo 2019-01-19 17:17:55 +08:00
parent 8e99507ff4
commit 51d5c22a7c

View File

@ -45,10 +45,9 @@ func (t *TaskMan) Put(cf *changedFile) {
}
func (t *TaskMan) preRun(cf *changedFile) {
if t.cmd != nil && t.cmd.Process != nil {
if t.cmd != nil && t.cmd.Process != nil && !t.cmd.ProcessState.Exited() {
log.Println("stop old process ")
err := t.cmd.Process.Kill()
if err != nil {
if err := t.cmd.Process.Kill(); err != nil {
log.Println(PreWarn, "stopped err, reason:", err)
}
}
@ -91,7 +90,7 @@ func (t *TaskMan) run(cf *changedFile) {
log.Println(PreWarn, "cmd wait err ", err)
break
}
if t.cmd.Process != nil {
if t.cmd.Process != nil && !t.cmd.ProcessState.Exited() {
if err = t.cmd.Process.Kill(); err != nil {
log.Println(PreWarn, "cmd cannot kill, reason:", err)
}