Add option to throw exception in build tool process utility
This commit is contained in:
@@ -285,6 +285,11 @@ namespace Flax.Build
|
||||
/// </summary>
|
||||
NoLoggingOfRunDuration = 1 << 5,
|
||||
|
||||
/// <summary>
|
||||
/// Throws exception when app returns non-zero return code.
|
||||
/// </summary>
|
||||
ThrowExceptionOnError = 1 << 6,
|
||||
|
||||
/// <summary>
|
||||
/// The default options.
|
||||
/// </summary>
|
||||
@@ -424,6 +429,11 @@ namespace Flax.Build
|
||||
{
|
||||
Log.Info(string.Format("Took {0}s to run {1}, ExitCode={2}", stopwatch.Elapsed.TotalSeconds, Path.GetFileName(app), result));
|
||||
}
|
||||
if (result != 0 && options.HasFlag(RunOptions.ThrowExceptionOnError))
|
||||
{
|
||||
var format = options.HasFlag(RunOptions.NoLoggingOfRunCommand) ? "App failed with exit code {2}." : "{0} {1} failed with exit code {2}";
|
||||
throw new Exception(string.Format(format, app, commandLine, result));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user