mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C#: Allow checking environment variables that may be undefined
The build mode environment variable for instance is only set when a build mode is specified.
This commit is contained in:
@@ -116,10 +116,9 @@ namespace Semmle.Autobuild.CSharp.Tests
|
||||
|
||||
string? IBuildActions.GetEnvironmentVariable(string name)
|
||||
{
|
||||
if (!GetEnvironmentVariable.TryGetValue(name, out var ret))
|
||||
throw new ArgumentException("Missing GetEnvironmentVariable " + name);
|
||||
|
||||
return ret;
|
||||
if (!GetEnvironmentVariable.ContainsKey(name))
|
||||
return null;
|
||||
return GetEnvironmentVariable[name];
|
||||
}
|
||||
|
||||
public string GetCurrentDirectory { get; set; } = "";
|
||||
|
||||
Reference in New Issue
Block a user