From b4ad9c53c60f7008d8a1850152fbb773ab68c440 Mon Sep 17 00:00:00 2001 From: liufumingren Date: Sat, 25 Jul 2026 01:59:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20runSsh=20=E6=94=B9=E7=94=A8=20base64=20?= =?UTF-8?q?=E7=AE=A1=E9=81=93=E4=BC=A0=E8=84=9A=E6=9C=AC=EF=BC=8C=E5=BD=BB?= =?UTF-8?q?=E5=BA=95=E9=81=BF=E5=85=8D=20bash=20-c=20=E5=B5=8C=E5=A5=97?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E8=BE=93=E5=87=BA=E5=8D=A1=E4=BD=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/deploy-lib.cjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script/deploy-lib.cjs b/script/deploy-lib.cjs index c0a3747..c95c474 100644 --- a/script/deploy-lib.cjs +++ b/script/deploy-lib.cjs @@ -220,10 +220,12 @@ function buildSshBaseArgs(config) { } function runSsh(config, remoteScript, options = {}) { + // Base64 编码脚本传给远端 bash,避免 shell 嵌套引用和输出信号问题 + const encoded = Buffer.from(remoteScript, 'utf8').toString('base64'); const args = [ ...buildSshBaseArgs(config), `${config.username}@${config.host}`, - `bash -c ${quoteForBash(remoteScript)}`, + `echo ${quoteForBash(encoded)} | base64 -d | bash`, ]; return runCommand('ssh', args, {