From 169a7d0df90ce109705c558d0feabbebdae73fcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=99=AF=E9=98=B3?= <1656488874@qq.com> Date: Thu, 26 Sep 2019 16:49:01 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=8F=AF=E8=83=BD=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E9=80=80=E5=87=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/services/task.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/services/task.go b/backend/services/task.go index e8d66a2a..1c26b45a 100644 --- a/backend/services/task.go +++ b/backend/services/task.go @@ -140,7 +140,7 @@ func ExecuteShellCmd(cmdStr string, cwd string, t model.Task, s model.Spider) (e // 传入信号,此处阻塞 signal := <-ch log.Infof("cancel process signal: %s", signal) - if signal == constants.TaskCancel { + if signal == constants.TaskCancel && cmd.Process != nil { // 取消进程 if err := cmd.Process.Kill(); err != nil { log.Errorf("process kill error: %s", err.Error())