Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
6e2c910c
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
大约 1 年 前同步成功
通知
11
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zentaoatf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6e2c910c
编写于
5月 17, 2023
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix sonar issues
上级
50132847
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
16 deletion
+26
-16
internal/pkg/helper/exec/errMsg.go
internal/pkg/helper/exec/errMsg.go
+22
-0
internal/pkg/helper/exec/file.go
internal/pkg/helper/exec/file.go
+3
-15
internal/pkg/helper/exec/interpreter.go
internal/pkg/helper/exec/interpreter.go
+1
-1
未找到文件。
internal/pkg/helper/exec/errMsg.go
0 → 100644
浏览文件 @
6e2c910c
package
execHelper
import
(
commConsts
"github.com/easysoft/zentaoatf/internal/pkg/consts"
websocketHelper
"github.com/easysoft/zentaoatf/internal/pkg/helper/websocket"
logUtils
"github.com/easysoft/zentaoatf/pkg/lib/log"
"github.com/fatih/color"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/websocket"
)
func
PrintErrMsg
(
key
string
,
err
error
,
wsMsg
*
websocket
.
Message
)
(
stdOutput
string
,
errOutput
string
)
{
if
commConsts
.
ExecFrom
==
commConsts
.
FromClient
{
websocketHelper
.
SendOutputMsg
(
err
.
Error
(),
""
,
iris
.
Map
{
"key"
:
key
},
wsMsg
)
}
logUtils
.
ExecConsolef
(
color
.
FgRed
,
err
.
Error
())
logUtils
.
ExecFilef
(
err
.
Error
())
return
""
,
err
.
Error
()
}
internal/pkg/helper/exec/file.go
浏览文件 @
6e2c910c
...
...
@@ -38,7 +38,7 @@ func RunFile(filePath, workspacePath string, conf commDomain.WorkspaceConf,
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
time
.
Second
*
time
.
Duration
(
timeout
))
defer
cancel
()
cmd
:=
setScriptInterpreter
(
filePath
,
lang
,
uuidString
,
conf
,
ctx
,
wsMsg
)
cmd
:=
getCommand
(
filePath
,
lang
,
uuidString
,
conf
,
ctx
,
wsMsg
)
if
cmd
==
nil
{
msgStr
:=
i118Utils
.
Sprintf
(
"cmd_empty"
)
...
...
@@ -60,21 +60,9 @@ func RunFile(filePath, workspacePath string, conf commDomain.WorkspaceConf,
stderr
,
err2
:=
cmd
.
StderrPipe
()
if
err1
!=
nil
{
if
commConsts
.
ExecFrom
==
commConsts
.
FromClient
{
websocketHelper
.
SendOutputMsg
(
err1
.
Error
(),
""
,
iris
.
Map
{
"key"
:
key
},
wsMsg
)
}
logUtils
.
ExecConsolef
(
color
.
FgRed
,
err1
.
Error
())
logUtils
.
ExecFilef
(
err1
.
Error
())
return
""
,
err1
.
Error
()
return
PrintErrMsg
(
key
,
err1
,
wsMsg
)
}
else
if
err2
!=
nil
{
if
commConsts
.
ExecFrom
==
commConsts
.
FromClient
{
websocketHelper
.
SendOutputMsg
(
err2
.
Error
(),
""
,
iris
.
Map
{
"key"
:
key
},
wsMsg
)
}
logUtils
.
ExecConsolef
(
color
.
FgRed
,
err2
.
Error
())
logUtils
.
ExecFilef
(
err2
.
Error
())
return
""
,
err2
.
Error
()
return
PrintErrMsg
(
key
,
err2
,
wsMsg
)
}
cmd
.
Start
()
...
...
internal/pkg/helper/exec/interpreter.go
浏览文件 @
6e2c910c
...
...
@@ -25,7 +25,7 @@ import (
"strings"
)
func
setScriptInterpreter
(
filePath
,
lang
,
uuidString
string
,
conf
commDomain
.
WorkspaceConf
,
ctx
context
.
Context
,
wsMsg
*
websocket
.
Message
)
(
func
getCommand
(
filePath
,
lang
,
uuidString
string
,
conf
commDomain
.
WorkspaceConf
,
ctx
context
.
Context
,
wsMsg
*
websocket
.
Message
)
(
cmd
*
exec
.
Cmd
)
{
if
commonUtils
.
IsWin
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录