From 834432c5c7cb5a29821778b017ffa6db0c1c6615 Mon Sep 17 00:00:00 2001 From: WuYongJie <549727955@qq.com> Date: Mon, 10 Aug 2026 11:40:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E7=A8=B3=E5=AE=9A?= =?UTF-8?q?=E6=8E=A2=E6=B5=8B=E5=A2=9E=E9=87=8F=E5=8F=91=E5=B8=83=E9=9A=A7?= =?UTF-8?q?=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/deploy-from-workstation.ps1 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/deploy-from-workstation.ps1 b/scripts/deploy-from-workstation.ps1 index fe839a54..a91f7445 100644 --- a/scripts/deploy-from-workstation.ps1 +++ b/scripts/deploy-from-workstation.ps1 @@ -215,6 +215,7 @@ function Start-RegistryTunnel { param([int]$LocalPort) $sshPath = (Get-Command ssh -ErrorAction Stop).Source + $curlPath = (Get-Command curl.exe -ErrorAction Stop).Source $startInfo = [Diagnostics.ProcessStartInfo]::new() $startInfo.FileName = $sshPath $startInfo.UseShellExecute = $false @@ -223,6 +224,7 @@ function Start-RegistryTunnel { '-N', '-i', $keyFullPath, '-o', 'BatchMode=yes', + '-o', 'ConnectTimeout=10', '-o', 'ExitOnForwardFailure=yes', '-o', 'ServerAliveInterval=15', '-L', "127.0.0.1:${LocalPort}:127.0.0.1:5000", @@ -237,14 +239,18 @@ function Start-RegistryTunnel { if ($process.HasExited) { throw 'SSH 增量传输隧道启动失败。' } - try { - Invoke-WebRequest -Uri "http://127.0.0.1:$LocalPort/v2/" -TimeoutSec 1 | Out-Null + & $curlPath ` + --fail ` + --silent ` + --show-error ` + --max-time 1 ` + "http://127.0.0.1:$LocalPort/v2/" 2>$null | Out-Null + if ($LASTEXITCODE -eq 0) { return $process } - catch { - Start-Sleep -Milliseconds 500 - $attempt++ - } + + Start-Sleep -Milliseconds 500 + $attempt++ } $process.Kill() -- 2.47.2