From d0e39b614c68cbb39cf649358b450fcef84cd595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Sat, 17 Aug 2024 17:37:44 +0200 Subject: [PATCH] temporary removal for cli.wrap to make sure it is not the culprit of the CI issue --- src/Amusoft.DotnetNew.Tests/CLI/DotnetNew.cs | 36 ++++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/Amusoft.DotnetNew.Tests/CLI/DotnetNew.cs b/src/Amusoft.DotnetNew.Tests/CLI/DotnetNew.cs index 015724d..80e2cff 100644 --- a/src/Amusoft.DotnetNew.Tests/CLI/DotnetNew.cs +++ b/src/Amusoft.DotnetNew.Tests/CLI/DotnetNew.cs @@ -1,4 +1,6 @@ -using System.IO; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using Amusoft.DotnetNew.Tests.Diagnostics; @@ -71,14 +73,42 @@ public static async Task BuildAsync(string fullPath, string? arguments, Verbosit var fullArgs = arguments is null ? $"build {fullPath} {restoreArgument} -v {verbosity.ToVerbosityText()}" : $"build {fullPath} {restoreArgument} -v {verbosity.ToVerbosityText()} {arguments}"; - if (await LoggedDotnetCli.RunDotnetCommandAsync(fullArgs, cancellationToken, [])) + + var psi = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? new ProcessStartInfo("dotnet", fullArgs) + { + UseShellExecute = false, + CreateNoWindow = true, + LoadUserProfile = false, + } + : new ProcessStartInfo("dotnet", fullArgs) + { + UseShellExecute = false, + CreateNoWindow = true, + }; + + var process = new Process(); + process.StartInfo = psi; + process.Start(); + + if (process.WaitForExit(30000)) { - loggingScope.ParentScope?.AddResult(new TextResult($"success: {fullArgs}")); + loggingScope.ParentScope?.AddResult(new TextResult($"success: {fullArgs}"));; } else { + process.Kill(); throw new BuildFailedException(fullArgs, loggingScope.ToFullString(PrintKind.All)); } + + // if (await LoggedDotnetCli.RunDotnetCommandAsync(fullArgs, cancellationToken, [])) + // { + // loggingScope.ParentScope?.AddResult(new TextResult($"success: {fullArgs}")); + // } + // else + // { + // throw new BuildFailedException(fullArgs, loggingScope.ToFullString(PrintKind.All)); + // } } }