Skip to content

Commit b1828a8

Browse files
committed
C#: Initialise DependabotProxy in DotNetCliInvoker
1 parent f346e38 commit b1828a8

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ private DotNet(IDotNetCliInvoker dotnetCliInvoker, ILogger logger, TemporaryDire
2727
Info();
2828
}
2929

30-
private DotNet(ILogger logger, string? dotNetPath, TemporaryDirectory tempWorkingDirectory) : this(new DotNetCliInvoker(logger, Path.Combine(dotNetPath ?? string.Empty, "dotnet")), logger, tempWorkingDirectory) { }
30+
private DotNet(ILogger logger, string? dotNetPath, TemporaryDirectory tempWorkingDirectory) : this(new DotNetCliInvoker(logger, Path.Combine(dotNetPath ?? string.Empty, "dotnet"), tempWorkingDirectory), logger, tempWorkingDirectory) { }
3131

3232
internal static IDotNet Make(IDotNetCliInvoker dotnetCliInvoker, ILogger logger) => new DotNet(dotnetCliInvoker, logger);
3333

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNetCliInvoker.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
1212
internal sealed class DotNetCliInvoker : IDotNetCliInvoker
1313
{
1414
private readonly ILogger logger;
15+
private readonly DependabotProxy proxy;
1516

1617
public string Exec { get; }
1718

18-
public DotNetCliInvoker(ILogger logger, string exec)
19+
public DotNetCliInvoker(ILogger logger, string exec, TemporaryDirectory tempWorkingDirectory)
1920
{
2021
this.logger = logger;
22+
this.proxy = new DependabotProxy(tempWorkingDirectory);
2123
this.Exec = exec;
2224
logger.LogInfo($"Using .NET CLI executable: '{Exec}'");
2325
}
@@ -38,6 +40,14 @@ private ProcessStartInfo MakeDotnetStartInfo(string args, string? workingDirecto
3840
startInfo.EnvironmentVariables["DOTNET_CLI_UI_LANGUAGE"] = "en";
3941
startInfo.EnvironmentVariables["MSBUILDDISABLENODEREUSE"] = "1";
4042
startInfo.EnvironmentVariables["DOTNET_SKIP_FIRST_TIME_EXPERIENCE"] = "true";
43+
44+
// Configure the proxy settings, if applicable.
45+
this.proxy.ApplyProxy(this.logger, startInfo);
46+
47+
this.logger.LogInfo(startInfo.EnvironmentVariables["HTTP_PROXY"] ?? "");
48+
this.logger.LogInfo(startInfo.EnvironmentVariables["HTTPS_PROXY"] ?? "");
49+
this.logger.LogInfo(startInfo.EnvironmentVariables["SSL_CERT_FILE"] ?? "");
50+
4151
return startInfo;
4252
}
4353

0 commit comments

Comments
 (0)