diff --git a/src/Commands/Command.cs b/src/Commands/Command.cs index 6e31d6e7..a35ba598 100644 --- a/src/Commands/Command.cs +++ b/src/Commands/Command.cs @@ -110,7 +110,13 @@ namespace SourceGit.Commands { errs.Add(e.Data); }; - proc.Start(); + try { + proc.Start(); + } catch (Exception e) { + if (!DontRaiseError) Models.Exception.Raise(e.Message); + return false; + } + proc.BeginOutputReadLine(); proc.BeginErrorReadLine(); proc.WaitForExit(); @@ -143,7 +149,15 @@ namespace SourceGit.Commands { if (!string.IsNullOrEmpty(Cwd)) start.WorkingDirectory = Cwd; var proc = new Process() { StartInfo = start }; - proc.Start(); + try { + proc.Start(); + } catch (Exception e) { + return new ReadToEndResult() { + Output = "", + Error = e.Message, + IsSuccess = false, + }; + } var rs = new ReadToEndResult(); rs.Output = proc.StandardOutput.ReadToEnd(); diff --git a/src/Commands/Config.cs b/src/Commands/Config.cs index 7b99a99d..19325ffe 100644 --- a/src/Commands/Config.cs +++ b/src/Commands/Config.cs @@ -4,8 +4,7 @@ namespace SourceGit.Commands { /// public class Config : Command { - public Config() { - } + public Config() {} public Config(string repo) { Cwd = repo;