From 90be76bb94d3c843077e650333d0a5ea9856c9d2 Mon Sep 17 00:00:00 2001 From: chenpei Date: Thu, 30 Jul 2026 16:18:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=84=E8=8C=83=E5=8C=96=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E8=84=9A=E6=9C=AC=E6=8D=A2=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/git-incremental-deploy.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/git-incremental-deploy.ps1 b/scripts/git-incremental-deploy.ps1 index 65d3c42..42d8d61 100644 --- a/scripts/git-incremental-deploy.ps1 +++ b/scripts/git-incremental-deploy.ps1 @@ -186,7 +186,11 @@ function Invoke-BuildServerScript { $scriptId = [guid]::NewGuid().ToString('N') $localTemp = Join-Path ([System.IO.Path]::GetTempPath()) "git-incremental-deploy-$scriptId.sh" $remoteTemp = "/tmp/git-incremental-deploy-$scriptId.sh" - [System.IO.File]::WriteAllText($localTemp, $ScriptText, [System.Text.UTF8Encoding]::new($false)) + # PowerShell here-string 在 Windows 下使用 CRLF;远端 Bash 会把行尾的 + # `\r` 当作参数内容,导致 `set -euo pipefail` 在脚本第一行就失败。 + # 上传前统一为 LF,保证脚本在 Linux 构建机上可直接执行。 + $normalizedScriptText = $ScriptText.Replace("`r`n", "`n").Replace("`r", "`n") + [System.IO.File]::WriteAllText($localTemp, $normalizedScriptText, [System.Text.UTF8Encoding]::new($false)) $authLabel = if ($usePasswordAuth) { 'password auth' } else { 'SSH key auth' } Write-Info "Connecting to build server $BuildServerUser@$BuildServerIP ($authLabel)"