From 000414733c990b7e721f27aaae3b6c31f02b993a Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Sun, 10 May 2026 13:14:42 +0000 Subject: [PATCH] [F] Fix powershell ssh --- powershell.ps1 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/powershell.ps1 b/powershell.ps1 index d71d308..100f0ef 100644 --- a/powershell.ps1 +++ b/powershell.ps1 @@ -47,7 +47,10 @@ function Invoke-ExternalCommand { } $Command = [string]$args[0] - $CommandArgs = if ($args.Count -gt 1) { @($args[1..($args.Count - 1)]) } else { @() } + $CommandArgs = @() + for ($i = 1; $i -lt $args.Count; $i++) { + $CommandArgs += ,$args[$i] + } $cmd = Get-ExternalCommandPath $Command if (-not $cmd) { Write-Error "$Command is not installed." @@ -314,13 +317,19 @@ function setproxy { } function global:ssh { + $sshExe = Get-ExternalCommandPath ssh + if (-not $sshExe) { + Write-Error 'ssh is not installed.' + return 127 + } + if ($env:TERM -eq 'xterm-kitty') { $oldTerm = $env:TERM $env:TERM = 'xterm-256color' - try { Invoke-ExternalCommand ssh @args } + try { & $sshExe @args } finally { $env:TERM = $oldTerm } } else { - Invoke-ExternalCommand ssh @args + & $sshExe @args } }