From 5c569b705cad84be0b017dc94dfdd979318e3279 Mon Sep 17 00:00:00 2001 From: Zzih96 <158246610+Zzih96@users.noreply.github.com> Date: Thu, 9 May 2024 14:15:06 +0800 Subject: [PATCH] [fix-15907] Fix get remote shell exit code is incorrect (#15911) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ./mvnw spotless:apply * Update dolphinscheduler-task-plugin/dolphinscheduler-task-remoteshell/src/main/java/org/apache/dolphinscheduler/plugin/task/remoteshell/RemoteExecutor.java Co-authored-by: Wenjun Ruan --------- Co-authored-by: 詹子恒 Co-authored-by: Wenjun Ruan Co-authored-by: Rick Cheng --- .../plugin/task/remoteshell/RemoteExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-remoteshell/src/main/java/org/apache/dolphinscheduler/plugin/task/remoteshell/RemoteExecutor.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-remoteshell/src/main/java/org/apache/dolphinscheduler/plugin/task/remoteshell/RemoteExecutor.java index 307023043a..814826a6bb 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-remoteshell/src/main/java/org/apache/dolphinscheduler/plugin/task/remoteshell/RemoteExecutor.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-remoteshell/src/main/java/org/apache/dolphinscheduler/plugin/task/remoteshell/RemoteExecutor.java @@ -131,7 +131,7 @@ public class RemoteExecutor implements AutoCloseable { int exitCode = -1; log.info("Remote shell task run status: {}", logLine); if (logLine.contains(STATUS_TAG_MESSAGE)) { - String status = logLine.replace(STATUS_TAG_MESSAGE, "").trim(); + String status = StringUtils.substringAfter(logLine, STATUS_TAG_MESSAGE); if (status.equals("0")) { log.info("Remote shell task success"); exitCode = 0;