From 09d376ec9a5e15eb043ebbf6be79195ed938ffe3 Mon Sep 17 00:00:00 2001 From: Paul Higinbotham Date: Thu, 20 Feb 2020 14:10:58 -0800 Subject: [PATCH] Fix SSH remoting error on Windows platform (#11907) --- .../engine/remoting/common/RunspaceConnectionInfo.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs b/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs index f7312183c7..937fa7dfab 100644 --- a/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs +++ b/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs @@ -2548,7 +2548,12 @@ namespace System.Management.Automation.Runspaces try { - var cmdLine = string.Format(CultureInfo.InvariantCulture, @"""{0}"" {1}", startInfo.FileName, startInfo.Arguments); + // Create process start command line with filename and argument list. + var cmdLine = string.Format( + CultureInfo.InvariantCulture, + @"""{0}"" {1}", + startInfo.FileName, + string.Join(' ', startInfo.ArgumentList)); lpStartupInfo.hStdInput = new SafeFileHandle(stdInPipeClient.DangerousGetHandle(), false); lpStartupInfo.hStdOutput = new SafeFileHandle(stdOutPipeClient.DangerousGetHandle(), false);