From 2e65c15f128642ea71049b7e30e68d050080534f Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Sat, 12 Oct 2024 18:42:50 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9A=82=E6=97=B6=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=20SocketException?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/metersphere/api/engine/KubernetesProvider.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/engine/KubernetesProvider.java b/backend/services/api-test/src/main/java/io/metersphere/api/engine/KubernetesProvider.java index eb79d6d17d..d97e4ab79c 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/engine/KubernetesProvider.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/engine/KubernetesProvider.java @@ -20,6 +20,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.util.CollectionUtils; +import java.net.SocketException; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ThreadLocalRandom; @@ -144,6 +145,7 @@ public class KubernetesProvider { .redirectingInput() .writingOutput(System.out) .writingError(System.err) + .withTTY() .usingListener(new SimpleListener(runRequest)) .exec(SHELL_COMMAND, "-c", command); } catch (Exception e) { @@ -160,11 +162,9 @@ public class KubernetesProvider { @Override public void onFailure(Throwable t, Response response) { LogUtils.error("K8s 监听失败", t); - if (runRequest != null) { + if (runRequest != null && !(t instanceof SocketException)) { handleGeneralError(runRequest, t); - return; } - throw new MSException("K8S 节点执行错误:" + t.getMessage(), t); } @Override