Skip to content

Commit 680cdca

Browse files
committed
feature: handle custom action error output
Signed-off-by: leo <[email protected]>
1 parent 9d2c2df commit 680cdca

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Commands/ExecuteCustomAction.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public static void Run(string repo, string file, string args, Action<string> out
3030
start.Environment.Add("PATH", Native.OS.CustomPathEnv);
3131

3232
var proc = new Process() { StartInfo = start };
33+
var builder = new StringBuilder();
34+
3335
proc.OutputDataReceived += (_, e) =>
3436
{
3537
if (e.Data != null)
@@ -39,7 +41,10 @@ public static void Run(string repo, string file, string args, Action<string> out
3941
proc.ErrorDataReceived += (_, e) =>
4042
{
4143
if (e.Data != null)
44+
{
4245
outputHandler?.Invoke(e.Data);
46+
builder.Append(e.Data);
47+
}
4348
};
4449

4550
try
@@ -57,7 +62,17 @@ public static void Run(string repo, string file, string args, Action<string> out
5762
});
5863
}
5964

65+
var exitCode = proc.ExitCode;
6066
proc.Close();
67+
68+
if (exitCode != 0)
69+
{
70+
var errMsg = builder.ToString();
71+
Dispatcher.UIThread.Invoke(() =>
72+
{
73+
App.RaiseException(repo, errMsg);
74+
});
75+
}
6176
}
6277
}
6378
}

0 commit comments

Comments
 (0)