mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -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);
|
start.Environment.Add("PATH", Native.OS.CustomPathEnv);
|
||||||
|
|
||||||
var proc = new Process() { StartInfo = start };
|
var proc = new Process() { StartInfo = start };
|
||||||
|
var builder = new StringBuilder();
|
||||||
|
|
||||||
proc.OutputDataReceived += (_, e) =>
|
proc.OutputDataReceived += (_, e) =>
|
||||||
{
|
{
|
||||||
if (e.Data != null)
|
if (e.Data != null)
|
||||||
|
@ -39,7 +41,10 @@ namespace SourceGit.Commands
|
||||||
proc.ErrorDataReceived += (_, e) =>
|
proc.ErrorDataReceived += (_, e) =>
|
||||||
{
|
{
|
||||||
if (e.Data != null)
|
if (e.Data != null)
|
||||||
|
{
|
||||||
outputHandler?.Invoke(e.Data);
|
outputHandler?.Invoke(e.Data);
|
||||||
|
builder.Append(e.Data);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -57,7 +62,17 @@ 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);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue