Skip to content

Commit b8ba594

Browse files
committed
Small fix to ensure debug environment is correctly set on non-Windows OS
1 parent 725d85f commit b8ba594

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

src/Azure.Functions.Cli/Actions/HostActions/StartHostAction.cs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Linq;
66
using System.Net;
77
using System.Net.Http;
8+
using System.Runtime.InteropServices;
89
using System.Security.Cryptography.X509Certificates;
910
using System.Threading.Tasks;
1011
using Azure.Functions.Cli.Actions.HostActions.WebHost.Security;
@@ -54,15 +55,30 @@ internal class StartHostAction : BaseAction
5455

5556
public DebuggerType Debugger { get; set; }
5657

57-
public IDictionary<string, string> IConfigurationArguments { get; set; } = new Dictionary<string, string>()
58-
{
59-
["workers:node:debug"] = Constants.NodeDebugPort.ToString(),
60-
["workers:java:debug"] = Constants.JavaDebugPort.ToString(),
61-
};
58+
public IDictionary<string, string> IConfigurationArguments { get; set; }
6259

6360
public StartHostAction(ISecretsManager secretsManager)
6461
{
6562
this._secretsManager = secretsManager;
63+
IConfigurationArguments = InitializeConfigurationArguments();
64+
}
65+
66+
private IDictionary<string, string> InitializeConfigurationArguments()
67+
{
68+
string nodeDebugKey = "workers:node:Debug";
69+
string javaDebugKey = "workers:java:Debug";
70+
71+
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
72+
{
73+
nodeDebugKey = nodeDebugKey.Replace(":", "__");
74+
javaDebugKey = javaDebugKey.Replace(":", "__");
75+
}
76+
77+
return new Dictionary<string, string>()
78+
{
79+
[nodeDebugKey] = Constants.NodeDebugPort.ToString(),
80+
[javaDebugKey] = Constants.JavaDebugPort.ToString(),
81+
};
6682
}
6783

6884
public override ICommandLineParserResult ParseArgs(string[] args)

0 commit comments

Comments
 (0)