Skip to content

Commit

Permalink
Debugging improvements to Which command
Browse files Browse the repository at this point in the history
  • Loading branch information
marticliment committed May 30, 2024
1 parent 8f35568 commit 8835c74
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/UniGetUI.Core.Tools/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public static void RelaunchProcess()
/// <returns>A tuple containing: a boolean hat represents wether the path was found or not; the path to the file if found.</returns>
public static async Task<Tuple<bool, string>> Which(string command)
{
Logger.Debug($"Begin \"which\" search for command {command}");
Process process = new()
{
StartInfo = new ProcessStartInfo()
Expand All @@ -100,9 +101,15 @@ public static async Task<Tuple<bool, string>> Which(string command)
output = line.Trim();
await process.WaitForExitAsync();
if (process.ExitCode != 0 || output == "")
{
Logger.ImportantInfo($"Command {command} was not found on the system");
return new Tuple<bool, string>(false, "");
}
else
{
Logger.Debug($"Command {command} was found on {output}");
return new Tuple<bool, string>(File.Exists(output), output);
}
}

/// <summary>
Expand Down

0 comments on commit 8835c74

Please sign in to comment.