From 35605730988bcef538f97d8ac83cd80692acdc5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=A8=E7=88=B1=E6=97=A0=E7=97=95?= Date: Wed, 28 Sep 2022 10:17:46 +0800 Subject: [PATCH] Fix issue --- internal/pkg/helper/exec/unit.go | 24 +++--------------------- ui/src/views/exec/LogList.vue | 2 +- ui/src/views/proxy/ProxyNav.vue | 6 +++--- 3 files changed, 7 insertions(+), 25 deletions(-) diff --git a/internal/pkg/helper/exec/unit.go b/internal/pkg/helper/exec/unit.go index 6f216236..ba826de2 100644 --- a/internal/pkg/helper/exec/unit.go +++ b/internal/pkg/helper/exec/unit.go @@ -3,7 +3,6 @@ package execHelper import ( "bufio" "errors" - "fmt" "io" "os/exec" "path/filepath" @@ -11,7 +10,6 @@ import ( "time" fileUtils "github.com/easysoft/zentaoatf/pkg/lib/file" - "github.com/gofrs/uuid" commConsts "github.com/easysoft/zentaoatf/internal/pkg/consts" configHelper "github.com/easysoft/zentaoatf/internal/pkg/helper/config" @@ -93,12 +91,11 @@ func ExecUnit(ch chan int, func RunUnitTest(ch chan int, cmdStr, workspacePath string, wsMsg *websocket.Message) (err error) { key := stringUtils.Md5(workspacePath) - uuidString := uuid.Must(uuid.NewV4()).String() var cmd *exec.Cmd if commonUtils.IsWin() { - cmd = exec.Command("cmd", "/C", cmdStr, "-uuid", uuidString) + cmd = exec.Command("cmd", "/C", cmdStr) } else { - cmd = exec.Command("/bin/bash", "-c", fmt.Sprintf("%s -uuid %s", cmdStr, uuidString)) + cmd = exec.Command("/bin/bash", "-c", cmdStr) } cmd.Dir = workspacePath @@ -138,22 +135,6 @@ func RunUnitTest(ch chan int, cmdStr, workspacePath string, wsMsg *websocket.Mes } cmd.Start() - go func() { - for { - select { - case _, ok := <-ch: - KillProcessByUUID(uuidString) - stdout.Close() - stderr.Close() - SetRunning(false) - if ok { - close(ch) - } - return - default: - } - } - }() isTerminal := false reader1 := bufio.NewReader(stdout) @@ -175,6 +156,7 @@ func RunUnitTest(ch chan int, cmdStr, workspacePath string, wsMsg *websocket.Mes select { case <-ch: + cmd.Process.Kill() msg := i118Utils.Sprintf("exit_exec_curr") if commConsts.ExecFrom != commConsts.FromCmd { diff --git a/ui/src/views/exec/LogList.vue b/ui/src/views/exec/LogList.vue index 78443cee..24cb0035 100644 --- a/ui/src/views/exec/LogList.vue +++ b/ui/src/views/exec/LogList.vue @@ -296,7 +296,7 @@ const exec = async (data: any) => { const checkProxyStatus = async (workspaceId, msg) => { if(msg.testSets == undefined){ - return {path: ''}; + return {path: 'local'}; } currentWorkspace.value = {}; let workspaceInfo = {} as any; diff --git a/ui/src/views/proxy/ProxyNav.vue b/ui/src/views/proxy/ProxyNav.vue index e85560b2..569265b8 100644 --- a/ui/src/views/proxy/ProxyNav.vue +++ b/ui/src/views/proxy/ProxyNav.vue @@ -1,11 +1,11 @@