Skip to content

Commit

Permalink
Warn instead of error if process.MainModule can't be accessed
Browse files Browse the repository at this point in the history
Closes #179
  • Loading branch information
Lauriethefish committed Aug 18, 2024
1 parent 018003e commit de7e817
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions QuestPatcher.Core/ProcessUtil.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Diagnostics;
using System.ComponentModel;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
using Serilog;

namespace QuestPatcher.Core
{
Expand Down Expand Up @@ -76,7 +78,16 @@ public static async Task<ProcessOutput> InvokeAndCaptureOutput(string fileName,
};

process.Start();
string? fullPath = process.MainModule?.FileName;
string? fullPath = null;
try
{
fullPath = process.MainModule?.FileName;
}
catch (Win32Exception ex)
{
Log.Warning(ex, "Failed to get full path to executing ADB client. Is the AntiVirus preventing this?");
}

process.BeginOutputReadLine();
process.BeginErrorReadLine();

Expand Down

0 comments on commit de7e817

Please sign in to comment.