Skip to content

Commit

Permalink
(#310) Resolve windows binary only on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiringWorm committed May 4, 2024
1 parent 4ee4916 commit 52c308e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions Source/Cake.Codecov.Tests/CodecovRunnerFixture.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Runtime.InteropServices;
using Cake.Codecov.Internals;
using Cake.Testing.Fixtures;

Expand All @@ -8,7 +9,7 @@ internal class CodecovRunnerFixture : ToolFixture<CodecovSettings>
private readonly IPlatformDetector _platformDetector;

public CodecovRunnerFixture()
: base("codecov.exe")
: base(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "codecov.exe" : "codecov")
{
}

Expand All @@ -20,9 +21,9 @@ public CodecovRunnerFixture(IPlatformDetector platformDetector, string expectedE

protected override void RunTool()
{
var tool = _platformDetector != null ?
new CodecovRunner(_platformDetector, FileSystem, Environment, ProcessRunner, Tools) :
new CodecovRunner(FileSystem, Environment, ProcessRunner, Tools);
var tool = _platformDetector != null
? new CodecovRunner(_platformDetector, FileSystem, Environment, ProcessRunner, Tools)
: new CodecovRunner(FileSystem, Environment, ProcessRunner, Tools);
tool.Run(Settings);
}
}
Expand Down
7 changes: 4 additions & 3 deletions Source/Cake.Codecov/CodecovRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ protected override IEnumerable<string> GetToolExecutableNames()
}
else
{
// Just to make sonarlint happy :)
// The official version of Codecov CLI can not run with the exe
// on anything other than Windows. As such we only return this
// in the else statement.
yield return "codecov.exe";
}

yield return "codecov.exe";
}

protected override string GetToolName() => "Codecov";
Expand Down

0 comments on commit 52c308e

Please sign in to comment.