Skip to content

Commit

Permalink
Merge pull request #2559 from FroggieFrog/fix-quote-binarylogger-file…
Browse files Browse the repository at this point in the history
…name

GH2558: fix quote filename of binary logger
  • Loading branch information
augustoproiete authored Feb 9, 2021
2 parents 6641a9f + 5748f10 commit ec61403
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
22 changes: 20 additions & 2 deletions src/Cake.Common.Tests/Unit/Tools/MSBuild/MSBuildRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ public void Should_Use_Binary_Logging_If_Specified()
var result = fixture.Run();

// Then
Assert.Equal("/v:normal /target:Build /bl:mylog.binlog;ProjectImports=ZipFile \"C:/Working/src/Solution.sln\"", result.Args);
Assert.Equal("/v:normal /target:Build /bl:\"mylog.binlog\";ProjectImports=ZipFile \"C:/Working/src/Solution.sln\"", result.Args);
}

[Fact]
Expand All @@ -1007,7 +1007,25 @@ public void Should_Use_Binary_Logging_If_Enabled()
var result = fixture.Run();

// Then
Assert.Equal("/v:normal /target:Build /bl:mylog.binlog;ProjectImports=ZipFile \"C:/Working/src/Solution.sln\"", result.Args);
Assert.Equal("/v:normal /target:Build /bl:\"mylog.binlog\";ProjectImports=ZipFile \"C:/Working/src/Solution.sln\"", result.Args);
}

[Fact]
public void Should_Quote_Binary_Logging_FilePath()
{
// Given
var fixture = new MSBuildRunnerFixture(false, PlatformFamily.Windows);
fixture.Settings.BinaryLogger = new MSBuildBinaryLogSettings()
{
Enabled = true,
FileName = "C:/Working Directory/src folder/mylog.binlog"
};

// When
var result = fixture.Run();

// Then
Assert.Equal("/v:normal /target:Build /bl:\"C:/Working Directory/src folder/mylog.binlog\" \"C:/Working/src/Solution.sln\"", result.Args);
}

[Theory]
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Common/Tools/MSBuild/MSBuildRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private ProcessArgumentBuilder GetArguments(FilePath projectFile, MSBuildSetting
string binaryOptions = null;
if (!string.IsNullOrEmpty(settings.BinaryLogger.FileName))
{
binaryOptions = settings.BinaryLogger.FileName;
binaryOptions = settings.BinaryLogger.FileName.Quote();
}

if (settings.BinaryLogger.Imports != MSBuildBinaryLogImports.Unspecified)
Expand Down

0 comments on commit ec61403

Please sign in to comment.