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 cf5483b..7716a9f 100644 --- a/agent/src/main/java/io/wdd/agent/executor/CommandExecutor.java +++ b/agent/src/main/java/io/wdd/agent/executor/CommandExecutor.java @@ -107,12 +107,6 @@ public class CommandExecutor { // 开始执行命令操作 Process process = processBuilder.start(); - // 缓存 命令处理日志 - commandExecLogCache.cacheLog( - streamKey, - process - ); - // 守护进程 对每一条任务的超时时间进行限制,避免卡死 int commandExecWaitTimeout = processMaxWaitSeconds; if (durationTask) { @@ -172,7 +166,11 @@ public class CommandExecutor { try { log.debug( - "命令执行守护进程开始等待 {} s for the result", + "[ {} ]命令执行守护进程开始等待 {} s for the result", + process + .info() + .commandLine() + .get(), commandExecWaitTimeout ); @@ -186,6 +184,12 @@ public class CommandExecutor { throw new RuntimeException(e); } finally { + // 缓存 命令处理日志 + commandExecLogCache.cacheLog( + streamKey, + process + ); + // 任务提前执行结束,或者超过了最长等待时间 // 判断命令是否正确处理完成 if (!commandExecComplete) { @@ -200,11 +204,11 @@ public class CommandExecutor { } // 日志操作,如果需要显示回传,需要将日志发送回相应的 - /*collectCommandLogAndRepeat( + collectCommandLogAndRepeat( streamKey, needResultReplay, octopusMessage - );*/ + ); // 只有当该进程还存活,执行关闭操作 if (process.isAlive()) {