提交 5574ce45 编写于 作者: Z zhaoke

* Fix issue

上级 d7077ddd
......@@ -8,7 +8,6 @@ import (
commConsts "github.com/easysoft/zentaoatf/internal/pkg/consts"
serverConfig "github.com/easysoft/zentaoatf/internal/server/config"
serverDomain "github.com/easysoft/zentaoatf/internal/server/modules/v1/domain"
commonUtils "github.com/easysoft/zentaoatf/pkg/lib/common"
"github.com/kataras/iris/v12/websocket"
)
......@@ -101,11 +100,3 @@ func KillLinuxProcessByUUID(uuid string) {
cmd.Start()
}
func KillProcessByUUID(uuid string) {
if commonUtils.IsWin() {
KillWinProcessByUUID(uuid)
} else {
KillLinuxProcessByUUID(uuid)
}
}
//go:build !windows
// +build !windows
package execHelper
import (
"fmt"
"os/exec"
)
func KillProcessByUUID(uuid string) {
command := fmt.Sprintf(`ps -ef | grep %s | grep -v "grep" | awk '{print $2}' | xargs kill -9`, uuid)
cmd := exec.Command(command)
cmd.Start()
}
......@@ -10,7 +10,7 @@ import (
"syscall"
)
func KillWinProcessByUUID(uuid string) {
func KillProcessByUUID(uuid string) {
cmd1 := exec.Command("cmd")
cmd1.SysProcAttr = &syscall.SysProcAttr{CmdLine: fmt.Sprintf(`/c WMIC path win32_process where "CommandLine like '%%%s%%'" get Processid,Caption`, uuid), HideWindow: true}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册