Skip to content

Commit

Permalink
[xharness] Allow for null environment variables to mlaunch. (#9140)
Browse files Browse the repository at this point in the history
It's a valid scenario to set a null environment variable.

This happens when changing InCI to always return true (to test locally what's
done on the bots), in which case we try to forward BUILD_REVISION to mlaunch,
but BUILD_REVISION isn't necessarily set. Not forwarding it to mlaunch should
not cause problems in most tests, so just allow this scenario.
  • Loading branch information
rolfbjarne authored and mandel-macaque committed Oct 21, 2020
1 parent 0eeecdd commit 15c8b00
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,11 @@ public sealed class SetEnvVariableArgument : MlaunchArgument {
public SetEnvVariableArgument (string variableName, object variableValue)
{
this.variableName = variableName ?? throw new ArgumentNullException (nameof (variableName));
this.variableValue = variableValue?.ToString () ?? throw new ArgumentNullException (nameof (variableValue));

if (variableValue is bool)
this.variableValue = this.variableValue.ToLower ();
if (variableValue is bool b)
this.variableValue = b.ToString ().ToLowerInvariant ();
else
this.variableValue = variableValue?.ToString ();
}

public override string AsCommandLineArgument () => Escape ($"-setenv={variableName}={variableValue}");
Expand Down

0 comments on commit 15c8b00

Please sign in to comment.