From 24cd77abb779b701f6230b08fc6ecb56c5ffcddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rald=20Barr=C3=A9?= Date: Fri, 23 Feb 2024 16:06:41 -0500 Subject: [PATCH] Use cliwrap --- .../PackageFixture.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/tests/Workleap.DotNet.CodingStandards.Tests/PackageFixture.cs b/tests/Workleap.DotNet.CodingStandards.Tests/PackageFixture.cs index 44da116..2c8df3e 100644 --- a/tests/Workleap.DotNet.CodingStandards.Tests/PackageFixture.cs +++ b/tests/Workleap.DotNet.CodingStandards.Tests/PackageFixture.cs @@ -1,5 +1,5 @@ -using System.Diagnostics; using CliWrap; +using CliWrap.Buffered; using Workleap.DotNet.CodingStandards.Tests.Helpers; namespace Workleap.DotNet.CodingStandards.Tests; @@ -26,19 +26,9 @@ public async Task InitializeAsync() } else { - // CliWrap doesn't support UseShellExecute. On Linux, it's easier to use it as "nuget" is a shell script that use mono to run nuget.exe - var psi = new ProcessStartInfo("nuget"); - foreach (var arg in args) - { - psi.ArgumentList.Add(arg); - } - - var p = Process.Start(psi)!; - await p.WaitForExitAsync(); - if (p.ExitCode != 0) - { - throw new InvalidOperationException("Error when running creating the NuGet package"); - } + _ = await Cli.Wrap("nuget") + .WithArguments(args) + .ExecuteBufferedAsync(); } }