mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
feature: handle custom action error output
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
9d2c2df6b3
commit
680cdca28d
1 changed files with 15 additions and 0 deletions
|
@ -30,6 +30,8 @@ namespace SourceGit.Commands
|
|||
start.Environment.Add("PATH", Native.OS.CustomPathEnv);
|
||||
|
||||
var proc = new Process() { StartInfo = start };
|
||||
var builder = new StringBuilder();
|
||||
|
||||
proc.OutputDataReceived += (_, e) =>
|
||||
{
|
||||
if (e.Data != null)
|
||||
|
@ -39,7 +41,10 @@ namespace SourceGit.Commands
|
|||
proc.ErrorDataReceived += (_, e) =>
|
||||
{
|
||||
if (e.Data != null)
|
||||
{
|
||||
outputHandler?.Invoke(e.Data);
|
||||
builder.Append(e.Data);
|
||||
}
|
||||
};
|
||||
|
||||
try
|
||||
|
@ -57,7 +62,17 @@ namespace SourceGit.Commands
|
|||
});
|
||||
}
|
||||
|
||||
var exitCode = proc.ExitCode;
|
||||
proc.Close();
|
||||
|
||||
if (exitCode != 0)
|
||||
{
|
||||
var errMsg = builder.ToString();
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
App.RaiseException(repo, errMsg);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue