Skip to content

Commit

Permalink
temporary removal for cli.wrap to make sure it is not the culprit of …
Browse files Browse the repository at this point in the history
…the CI issue
  • Loading branch information
taori committed Aug 17, 2024
1 parent d6bb18d commit d0e39b6
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions src/Amusoft.DotnetNew.Tests/CLI/DotnetNew.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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));
// }
}
}

Expand Down

0 comments on commit d0e39b6

Please sign in to comment.