From ec1ec6fc4b46554e1374b94136f29d1dd05334c8 Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 6 Jun 2026 02:25:28 +0000 Subject: [PATCH] fix: normalize Windows cmd stdin newlines --- scripts/src/ssh.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/src/ssh.ts b/scripts/src/ssh.ts index d5f7ba2c..078bddd3 100644 --- a/scripts/src/ssh.ts +++ b/scripts/src/ssh.ts @@ -1186,6 +1186,10 @@ function buildWindowsCmdStdinLauncherScript(cwd: string | null): string { "$env:PYTHONUTF8 = '1';", "$env:PYTHONIOENCODING = 'utf-8';", "$script = [Console]::In.ReadToEnd();", + "$script = $script -replace \"`r`n\", \"`n\";", + "$script = $script -replace \"`r\", \"`n\";", + "$script = $script -replace \"`n\", \"`r`n\";", + "if (-not $script.EndsWith(\"`r`n\")) { $script += \"`r`n\" }", "if ([string]::IsNullOrWhiteSpace($script)) { [Console]::Error.WriteLine('ssh win cmd requires a command line or stdin batch script'); exit 2 }", `$prefix = ${powerShellSingleQuote(`${prefixLines.join("\r\n")}\r\n`)};`, "$temp = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), ('unidesk-win-cmd-' + [guid]::NewGuid().ToString('N') + '.cmd'));",