8000 Fixes KeyFilePath parameter for Linux systems (#4529) · PowerShell/PowerShell@6b8d86f · GitHub
[go: up one dir, main page]

Skip to con 8000 tent

Commit 6b8d86f

Browse files
PaulHiginadityapatwardhan
authored andcommitted
Fixes KeyFilePath parameter for Linux systems (#4529)
1 parent b953ab1 commit 6b8d86f

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,35 @@ private static string[] ParseArgv(ProcessStartInfo psi)
22172217
{
22182218
var argvList = new List<string>();
22192219
argvList.Add(psi.FileName);
2220-
argvList.AddRange(psi.Arguments.Split(' '));
2220+
2221+
var argsToParse = psi.Arguments.Trim();
2222+
var argsLength = argsToParse.Length;
2223+
for (int i=0; i<argsLength; )
2224+
{
2225+
var iStart = i;
2226+
2227+
switch (argsToParse[i])
2228+
{
2229+
case '"':
2230+
// Special case for arguments within quotes
2231+
// Just return argument value within the quotes
2232+
while ((++i < argsLength) && argsToParse[i] != '"') { };
2233+
if (iStart < argsLength - 1)
2234+
{
2235+
iStart++;
2236+
}
2237+
break;
2238+
2239+
default:
2240+
// Common case for parsing arguments with space character delimiter
2241+
while ((++i < argsLength) && argsToParse[i] != ' ') { };
2242+
break;
2243+
}
2244+
2245+
argvList.Add(argsToParse.Substring(iStart, (i-iStart)));
2246+
while ((++i < argsLength) && argsToParse[i] == ' ') { };
2247+
}
2248+
22212249
return argvList.ToArray();
22222250
}
22232251

src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,12 @@ internal override void CreateAsync()
14611461
StartReaderThread(_stdOutReader);
14621462
}
14631463

1464+
internal override void CloseAsync()
1465+
{
1466+
base.CloseAsync();
1467+
CloseConnection();
1468+
}
1469+
14641470
#endregion
14651471

14661472
#region Private Methods

0 commit comments

Comments
 (0)
0