Skip to content

Commit

Permalink
Merge pull request #163 from bdach/better-tool-location-failure-messa…
Browse files Browse the repository at this point in the history
…ging

Improve error messaging when locating tools fails
  • Loading branch information
smoogipoo authored Feb 27, 2024
2 parents d56264e + 3555d5c commit 34eec63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -678,13 +678,17 @@ private static string getToolPath(string packageName, string toolExecutable)
{
var process = Process.Start(new ProcessStartInfo("dotnet", "list osu.Desktop.Deploy.csproj package")
{
RedirectStandardOutput = true
RedirectStandardOutput = true,
RedirectStandardError = true,
});

Debug.Assert(process != null);

process.WaitForExit();

if (process.ExitCode != 0)
throw new InvalidOperationException($"Could not locate tool {toolExecutable}!\nStandard error: {process.StandardError.ReadToEnd()}");

string output = process.StandardOutput.ReadToEnd();

var match = Regex.Matches(output, $@"(?m){packageName.Replace(".", "\\.")}.*\s(\d{{1,3}}\.\d{{1,3}}\.\d.*?)$");
Expand Down

0 comments on commit 34eec63

Please sign in to comment.