From 0d8c89e4ec681dc7bd16a2b524a9e297a7ebb813 Mon Sep 17 00:00:00 2001 From: zeaslity Date: Sat, 25 Feb 2023 18:17:36 +0800 Subject: [PATCH] [agent][executor]- bug --- .../java/io/wdd/agent/executor/CommandExecutor.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/agent/src/main/java/io/wdd/agent/executor/CommandExecutor.java b/agent/src/main/java/io/wdd/agent/executor/CommandExecutor.java index dd6704e..cf5483b 100644 --- a/agent/src/main/java/io/wdd/agent/executor/CommandExecutor.java +++ b/agent/src/main/java/io/wdd/agent/executor/CommandExecutor.java @@ -57,7 +57,6 @@ public class CommandExecutor { */ public void execute(OctopusMessage octopusMessage, ExecutionMessage executionMessage) { - // todo 需要长时间执行的任务 与目前的系统设计存在冲突 防卡死后台进程`出现问题 // 防止阻塞消息队列中的其他信息,需要使用异步执行 AgentCommonThreadPool.pool.submit( () -> this.execute( @@ -140,13 +139,10 @@ public class CommandExecutor { int waitFor = process.waitFor(); // get the process result - if (ObjectUtils.isNotEmpty(waitFor) && ObjectUtils.isNotEmpty(process)) { + if (ObjectUtils.isNotEmpty(waitFor) && ObjectUtils.isNotEmpty(process.info())) { // 命令执行完成, countDownLatch计数 countDownLatch.countDown(); - // 设置 命令执行退出返回值 - processResult = process.exitValue(); - } log.debug( @@ -155,6 +151,9 @@ public class CommandExecutor { processResult ); + // 设置 命令执行退出返回值 + processResult = process.exitValue(); + } catch (IOException | InterruptedException e) { log.error( "Shell command error ! {} + {}", @@ -201,11 +200,11 @@ public class CommandExecutor { } // 日志操作,如果需要显示回传,需要将日志发送回相应的 - collectCommandLogAndRepeat( + /*collectCommandLogAndRepeat( streamKey, needResultReplay, octopusMessage - ); + );*/ // 只有当该进程还存活,执行关闭操作 if (process.isAlive()) {