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'));",