File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
src/System.Management.Automation/engine/remoting Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -2217,7 +2217,35 @@ private static string[] ParseArgv(ProcessStartInfo psi)
2217
2217
{
2218
2218
var argvList = new List < string > ( ) ;
2219
2219
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
+
2221
2249
return argvList . ToArray ( ) ;
2222
2250
}
2223
2251
Original file line number Diff line number Diff line change @@ -1461,6 +1461,12 @@ internal override void CreateAsync()
1461
1461
StartReaderThread ( _stdOutReader ) ;
1462
1462
}
1463
1463
1464
+ internal override void CloseAsync ( )
1465
+ {
1466
+ base . CloseAsync ( ) ;
1467
+ CloseConnection ( ) ;
1468
+ }
1469
+
1464
1470
#endregion
1465
1471
1466
1472
#region Private Methods
You can’t perform that action at this time.
0 commit comments