[agent][executor]- bug - 2

This commit is contained in:
zeaslity
2023-02-25 18:26:43 +08:00
parent bdf13f5f41
commit f1e315b983

View File

@@ -166,7 +166,7 @@ public class CommandExecutor {
try {
log.debug(
"[ {} ]命令执行守护进程开始等待 {} s for the result",
"[ {} ] 命令执行守护进程开始等待 {} ",
process
.info()
.commandLine()
@@ -184,11 +184,7 @@ public class CommandExecutor {
throw new RuntimeException(e);
} finally {
// 缓存 命令处理日志
commandExecLogCache.cacheLog(
streamKey,
process
);
// 任务提前执行结束,或者超过了最长等待时间
// 判断命令是否正确处理完成
@@ -201,8 +197,23 @@ public class CommandExecutor {
.get(),
commandExecWaitTimeout
);
// 命令没有正确的处理完成,需要手动关停程序
// 只有当该进程还存活,执行关闭操作
if (process.isAlive()) {
// shutdown the process
log.debug("开始销毁命令执行进程!");
process.destroy();
}
}
// 缓存 命令处理日志
commandExecLogCache.cacheLog(
streamKey,
process
);
// 日志操作,如果需要显示回传,需要将日志发送回相应的
collectCommandLogAndRepeat(
streamKey,
@@ -210,13 +221,6 @@ public class CommandExecutor {
octopusMessage
);
// 只有当该进程还存活,执行关闭操作
if (process.isAlive()) {
// shutdown the process
log.debug("开始销毁命令执行进程!");
process.destroyForcibly();
}
}
};
}