Skip to content

Commit fc5b043

Browse files
authored
Powershell splits CLI arguments on "." before passing them into applications (#4924)
1 parent ef383bc commit fc5b043

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/core/Akka.Remote.TestKit/CommandLine.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//-----------------------------------------------------------------------
77

88
using System;
9+
using System.Collections.Generic;
910
using System.Collections.Specialized;
1011
using Akka.Configuration;
1112

@@ -32,7 +33,23 @@ public class CommandLine
3233
static CommandLine()
3334
{
3435
Values = new StringDictionary();
35-
foreach (var arg in Environment.GetCommandLineArgs())
36+
37+
// Detect and fix PowerShell command line input.
38+
// PowerShell splits command line arguments on '.'
39+
var args = Environment.GetCommandLineArgs();
40+
var fixedArgs = new List<string>();
41+
for (var i = 1; i < args.Length - 1; ++i)
42+
{
43+
if (args[i].Equals("-Dmultinode") && args[i + 1].StartsWith("."))
44+
{
45+
fixedArgs.Add(args[i] + args[i+1]);
46+
++i;
47+
}
48+
}
49+
if(fixedArgs.Count == 0)
50+
fixedArgs.AddRange(args);
51+
52+
foreach (var arg in fixedArgs)
3653
{
3754
if (!arg.StartsWith("-D"))
3855
{

0 commit comments

Comments
 (0)