This commit is contained in:
leo 2021-08-04 19:21:27 +08:00
parent 78bb68b82e
commit 8894705321
2 changed files with 17 additions and 4 deletions

View file

@ -110,7 +110,13 @@ namespace SourceGit.Commands {
errs.Add(e.Data); errs.Add(e.Data);
}; };
proc.Start(); try {
proc.Start();
} catch (Exception e) {
if (!DontRaiseError) Models.Exception.Raise(e.Message);
return false;
}
proc.BeginOutputReadLine(); proc.BeginOutputReadLine();
proc.BeginErrorReadLine(); proc.BeginErrorReadLine();
proc.WaitForExit(); proc.WaitForExit();
@ -143,7 +149,15 @@ namespace SourceGit.Commands {
if (!string.IsNullOrEmpty(Cwd)) start.WorkingDirectory = Cwd; if (!string.IsNullOrEmpty(Cwd)) start.WorkingDirectory = Cwd;
var proc = new Process() { StartInfo = start }; 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(); var rs = new ReadToEndResult();
rs.Output = proc.StandardOutput.ReadToEnd(); rs.Output = proc.StandardOutput.ReadToEnd();

View file

@ -4,8 +4,7 @@ namespace SourceGit.Commands {
/// </summary> /// </summary>
public class Config : Command { public class Config : Command {
public Config() { public Config() {}
}
public Config(string repo) { public Config(string repo) {
Cwd = repo; Cwd = repo;