fix: crash if the executable file can not be found

This commit is contained in:
leo 2024-12-31 09:38:32 +08:00
parent addc756fbf
commit a6420aff9b
No known key found for this signature in database

View file

@ -53,6 +53,16 @@ namespace SourceGit.Commands
proc.BeginOutputReadLine(); proc.BeginOutputReadLine();
proc.BeginErrorReadLine(); proc.BeginErrorReadLine();
proc.WaitForExit(); proc.WaitForExit();
var exitCode = proc.ExitCode;
if (exitCode != 0)
{
var errMsg = builder.ToString();
Dispatcher.UIThread.Invoke(() =>
{
App.RaiseException(repo, errMsg);
});
}
} }
catch (Exception e) catch (Exception e)
{ {
@ -62,17 +72,7 @@ namespace SourceGit.Commands
}); });
} }
var exitCode = proc.ExitCode;
proc.Close(); proc.Close();
if (exitCode != 0)
{
var errMsg = builder.ToString();
Dispatcher.UIThread.Invoke(() =>
{
App.RaiseException(repo, errMsg);
});
}
} }
} }
} }