Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
f088fabc
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
f088fabc
编写于
2月 17, 2022
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
kill sub process on linux
上级
88165066
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
165 addition
and
198 deletion
+165
-198
client/package-lock.json
client/package-lock.json
+113
-149
client/package.json
client/package.json
+3
-1
client/src/main.js
client/src/main.js
+1
-4
client/src/service.js
client/src/service.js
+37
-35
internal/comm/helper/zentao/zentao.go
internal/comm/helper/zentao/zentao.go
+1
-4
internal/server/modules/v1/controller/zentao.go
internal/server/modules/v1/controller/zentao.go
+4
-4
res/server/zh/messages.json
res/server/zh/messages.json
+5
-1
xdoc/notes.txt
xdoc/notes.txt
+1
-0
未找到文件。
client/package-lock.json
浏览文件 @
f088fabc
此差异已折叠。
点击以展开。
client/package.json
浏览文件 @
f088fabc
...
...
@@ -41,7 +41,9 @@
"dependencies"
:
{
"electron-log"
:
"^4.4.6"
,
"electron-squirrel-startup"
:
"^1.0.0"
,
"express"
:
"^4.17.3"
,
"find-process"
:
"^1.4.7"
,
"ps-tree"
:
"^1.2.0"
"ps-tree"
:
"^1.2.0"
,
"tree-kill"
:
"^1.2.2"
}
}
client/src/main.js
浏览文件 @
f088fabc
...
...
@@ -69,7 +69,6 @@ app.on('window-all-closed', () => {
app
.
on
(
'
before-quit
'
,
function
(){
logInfo
(
`>> Event before-quit`
)
killZtfServer
();
})
app
.
on
(
'
will-quit
'
,
function
(){
...
...
@@ -78,6 +77,7 @@ app.on('will-quit',function(){
app
.
on
(
'
quit
'
,
function
(){
logInfo
(
`>> Event quit`
)
killZtfServer
();
})
app
.
on
(
'
activate
'
,
()
=>
{
...
...
@@ -89,6 +89,3 @@ app.on('activate', () => {
startApp
();
}
});
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and import them here.
client/src/service.js
浏览文件 @
f088fabc
...
...
@@ -7,6 +7,8 @@ import {logInfo, logErr} from './log';
const
DEBUG
=
process
.
env
.
NODE_ENV
===
'
development
'
;
const
isWin
=
/^win/
.
test
(
process
.
platform
);
const
isLinux
=
/^linux/
.
test
(
process
.
platform
);
const
isMac
=
/^darwin/
.
test
(
process
.
platform
);
let
_ztfServerProcess
;
export
function
startZtfServer
()
{
...
...
@@ -71,6 +73,7 @@ export function startZtfServer() {
reject
(
spawnError
)
});
_ztfServerProcess
=
cmd
;
logInfo
(
`>> _ztfServerProcess =
${
_ztfServerProcess
.
pid
}
`
)
});
}
...
...
@@ -114,22 +117,6 @@ export function startZtfServer() {
});
}
export
function
killZtfServer
()
{
if
(
!
isWin
)
{
_ztfServerProcess
.
kill
(
'
SIGINT
'
);
kill
(
_ztfServerProcess
.
pid
);
}
else
{
const
cp
=
require
(
'
child_process
'
);
cp
.
exec
(
'
taskkill /PID
'
+
_ztfServerProcess
.
pid
+
'
/T /F
'
,
function
(
error
,
stdout
,
stderr
)
{
// console.log('stdout: ' + stdout);
// console.log('stderr: ' + stderr);
// if(error !== null) {
// console.log('exec error: ' + error);
// }
});
}
}
let
_uiServerApp
;
export
function
getUIServerUrl
()
{
...
...
@@ -225,27 +212,42 @@ export function getUIServerUrl() {
});
}
const
psTree
=
require
(
'
ps-tree
'
);
export
function
killZtfServer
()
{
if
(
isWin
)
{
logInfo
(
`>> isWin`
);
const
cp
=
require
(
'
child_process
'
);
cp
.
exec
(
'
taskkill /PID
'
+
_ztfServerProcess
.
pid
+
'
/T /F
'
,
function
(
error
,
stdout
,
stderr
)
{
// console.log('stdout: ' + stdout + ', stderr: ' + stderr);
// if(error !== null) console.log('exec error: ' + error);
});
}
else
if
(
isMac
)
{
logInfo
(
`>> isMac`
);
_ztfServerProcess
.
kill
();
}
else
{
logInfo
(
`>> isLinux`
);
kill
(
_ztfServerProcess
.
pid
);
}
}
function
kill
(
pid
,
signal
,
callback
)
{
signal
=
signal
||
'
SIGKILL
'
;
const
psTree
=
require
(
'
ps-tree
'
);
function
kill
(
pid
,
signal
,
callback
)
{
signal
=
signal
||
'
SIGKILL
'
;
callback
=
callback
||
function
()
{};
const
killTree
=
true
;
if
(
killTree
)
{
psTree
(
pid
,
function
(
err
,
children
)
{
[
pid
].
concat
(
children
.
map
(
function
(
p
)
{
return
p
.
PID
;
})
).
forEach
(
function
(
tpid
)
{
try
{
process
.
kill
(
tpid
,
signal
)
}
catch
(
ex
)
{
}
});
callback
();
psTree
(
pid
,
function
(
err
,
children
)
{
[
pid
].
concat
(
children
.
map
(
function
(
p
)
{
return
p
.
PID
;
})
).
forEach
(
function
(
tpid
)
{
logInfo
(
`>>
${
tpid
}
`
)
try
{
process
.
kill
(
tpid
,
signal
)
}
catch
(
ex
)
{
logErr
(
`>> `
+
ex
)
}
});
}
else
{
try
{
process
.
kill
(
pid
,
signal
)
}
catch
(
ex
)
{
}
callback
();
}
}
);
};
internal/comm/helper/zentao/zentao.go
浏览文件 @
f088fabc
...
...
@@ -98,7 +98,7 @@ func ListLang() (langs []serverDomain.ZentaoLang, err error) {
func
ListProduct
(
projectPath
string
)
(
products
[]
serverDomain
.
ZentaoProduct
,
err
error
)
{
config
:=
configUtils
.
LoadByProjectPath
(
projectPath
)
if
config
.
Url
==
""
{
err
=
errors
.
New
(
"请先完成项目配置"
)
err
=
errors
.
New
(
i118Utils
.
Sprintf
(
"pls_config_project"
)
)
return
}
...
...
@@ -120,7 +120,6 @@ func ListProduct(projectPath string) (products []serverDomain.ZentaoProduct, err
bytes
,
err
:=
httpUtils
.
Get
(
url
)
if
err
!=
nil
{
err
=
errors
.
New
(
"请检查项目配置"
)
return
}
...
...
@@ -242,7 +241,6 @@ func ListSuiteByProduct(productId int, projectPath string) (suites []serverDomai
bytes
,
err
:=
httpUtils
.
Get
(
url
)
if
err
!=
nil
{
err
=
errors
.
New
(
"testsuite-browse fail"
)
return
}
...
...
@@ -280,7 +278,6 @@ func ListTaskByProduct(productId int, projectPath string) (tasks []serverDomain.
bytes
,
err
:=
httpUtils
.
Get
(
url
)
if
err
!=
nil
{
err
=
errors
.
New
(
"testsuite-browse fail"
)
return
}
...
...
internal/server/modules/v1/controller/zentao.go
浏览文件 @
f088fabc
...
...
@@ -36,7 +36,7 @@ func (c *ZentaoCtrl) ListModule(ctx iris.Context) {
projectPath
:=
ctx
.
URLParam
(
"currProject"
)
productId
,
err
:=
ctx
.
URLParamInt
(
"productId"
)
if
err
!=
nil
{
c
.
ErrResp
(
commConsts
.
ParamErr
,
err
.
Error
(
))
c
tx
.
JSON
(
c
.
ErrResp
(
commConsts
.
ParamErr
,
err
.
Error
()
))
return
}
...
...
@@ -53,7 +53,7 @@ func (c *ZentaoCtrl) ListSuite(ctx iris.Context) {
projectPath
:=
ctx
.
URLParam
(
"currProject"
)
productId
,
err
:=
ctx
.
URLParamInt
(
"productId"
)
if
err
!=
nil
{
c
.
ErrResp
(
commConsts
.
ParamErr
,
err
.
Error
(
))
c
tx
.
JSON
(
c
.
ErrResp
(
commConsts
.
ParamErr
,
err
.
Error
()
))
return
}
...
...
@@ -70,7 +70,7 @@ func (c *ZentaoCtrl) ListTask(ctx iris.Context) {
projectPath
:=
ctx
.
URLParam
(
"currProject"
)
productId
,
err
:=
ctx
.
URLParamInt
(
"productId"
)
if
err
!=
nil
{
c
.
ErrResp
(
commConsts
.
ParamErr
,
err
.
Error
(
))
c
tx
.
JSON
(
c
.
ErrResp
(
commConsts
.
ParamErr
,
err
.
Error
()
))
return
}
...
...
@@ -88,7 +88,7 @@ func (c *ZentaoCtrl) GetDataForBugSubmition(ctx iris.Context) {
req
:=
commDomain
.
FuncResult
{}
if
err
:=
ctx
.
ReadJSON
(
&
req
);
err
!=
nil
{
c
.
ErrResp
(
commConsts
.
ParamErr
,
err
.
Error
(
))
c
tx
.
JSON
(
c
.
ErrResp
(
commConsts
.
ParamErr
,
err
.
Error
()
))
return
}
...
...
res/server/zh/messages.json
浏览文件 @
f088fabc
...
...
@@ -15,7 +15,11 @@
},
{
"id"
:
"data_not_init"
,
"translation"
:
"数据为初始化"
"translation"
:
"数据未初始化"
},
{
"id"
:
"pls_config_project"
,
"translation"
:
"请先完成项目配置"
},
{
"id"
:
"project_config_err"
,
...
...
xdoc/notes.txt
浏览文件 @
f088fabc
...
...
@@ -24,6 +24,7 @@ cd client && npm run package-win64 && cd ..
make compile_linux
cd client && npm run package-linux && cd ..
scp -r client/out/ztf-linux-x64/ 192.168.0.114:/home/aaron
make compile_mac
cd client && npm run package-mac && cd ..
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录