From 7d7b16fe5c3ef7e6d1e7777ed1037107952af6cc Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Wed, 7 Aug 2024 12:13:59 -0300 Subject: [PATCH] Don't allow non-trx logger on non-Windows OS This failed consistently in CI and locally (WSL), so prevent users from having an unsupported combination. --- src/dotnet-retest/RetestCommand.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/dotnet-retest/RetestCommand.cs b/src/dotnet-retest/RetestCommand.cs index 1ccac61..38b663d 100644 --- a/src/dotnet-retest/RetestCommand.cs +++ b/src/dotnet-retest/RetestCommand.cs @@ -45,6 +45,7 @@ public override async Task ExecuteAsync(CommandContext context, RetestSetti string? path = null; var hastrx = false; var hasconsole = false; + var haslogger = false; new OptionSet { @@ -52,11 +53,19 @@ public override async Task ExecuteAsync(CommandContext context, RetestSetti { hastrx = v.StartsWith("trx"); hasconsole = v.StartsWith("console"); + haslogger = true; } }, { "results-directory=", v => path = v }, }.Parse(args); + // In non-Windows OSes, the trx logger must be the only one if specified + if (haslogger && !hastrx && !RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + MarkupLine("[red]If a logger is specified, it can only be trx in non-Windows platforms.[/]"); + return 1; + } + var trx = new TrxCommand.TrxSettings { Path = path,