Skip to content

Commit

Permalink
Powershell splits CLI arguments on "." before passing them into appli…
Browse files Browse the repository at this point in the history
…cations (#4924)
  • Loading branch information
Arkatufus authored Apr 12, 2021
1 parent ef383bc commit fc5b043
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/core/Akka.Remote.TestKit/CommandLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//-----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using Akka.Configuration;

Expand All @@ -32,7 +33,23 @@ public class CommandLine
static CommandLine()
{
Values = new StringDictionary();
foreach (var arg in Environment.GetCommandLineArgs())

// Detect and fix PowerShell command line input.
// PowerShell splits command line arguments on '.'
var args = Environment.GetCommandLineArgs();
var fixedArgs = new List<string>();
for (var i = 1; i < args.Length - 1; ++i)
{
if (args[i].Equals("-Dmultinode") && args[i + 1].StartsWith("."))
{
fixedArgs.Add(args[i] + args[i+1]);
++i;
}
}
if(fixedArgs.Count == 0)
fixedArgs.AddRange(args);

foreach (var arg in fixedArgs)
{
if (!arg.StartsWith("-D"))
{
Expand Down

0 comments on commit fc5b043

Please sign in to comment.