修复 nginx 转发stream接口失效,停止运行命令支持 pid 参数

This commit is contained in:
whyour
2023-05-04 21:28:14 +08:00
parent 01b404765e
commit 8b8bd279c6
4 changed files with 23 additions and 6 deletions
+5 -1
View File
@@ -170,6 +170,9 @@ export default (app: Router) => {
await systemService.run(
{ ...req.body, logPath },
{
onStart: async (cp, startTime) => {
res.setHeader('QL-Task-Pid', `${cp.pid}`);
},
onEnd: async (cp, endTime, diff) => {
res.end();
},
@@ -195,7 +198,8 @@ export default (app: Router) => {
'/command-stop',
celebrate({
body: Joi.object({
command: Joi.string().required(),
command: Joi.string().optional(),
pid: Joi.number().optional(),
}),
}),
async (req: Request, res: Response, next: NextFunction) => {