From 9763cb00e5d95b2fa5d1c2d3d4a8eecac71600e6 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Tue, 15 Jul 2025 16:41:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dssh=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E5=91=BD=E4=BB=A4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/plugins/plugin-lib/src/ssh/ssh.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/plugins/plugin-lib/src/ssh/ssh.ts b/packages/plugins/plugin-lib/src/ssh/ssh.ts index b7d203a6..e80079a4 100644 --- a/packages/plugins/plugin-lib/src/ssh/ssh.ts +++ b/packages/plugins/plugin-lib/src/ssh/ssh.ts @@ -506,10 +506,6 @@ export class SshClient { isWinCmd = await this.isCmd(conn); } - if (isLinux && options.stopOnError !== false) { - script = "set -e\n" + script; - } - if (options.env) { for (const key in options.env) { if (isLinux) { @@ -525,10 +521,10 @@ export class SshClient { } if (isWinCmd) { - //组合成&&的形式 if (typeof script === "string") { script = script.split("\n"); } + //组合成&&的形式 script = envScripts.concat(script); script = script as Array; script = script.join(" && "); @@ -543,6 +539,10 @@ export class SshClient { } } + if (isLinux && options.stopOnError !== false) { + script = "set -e\n" + script; + } + return await conn.exec(script as string, { throwOnStdErr }); }, });