diff --git a/UnityXrefMaps/Commands/BuildCommand.cs b/UnityXrefMaps/Commands/BuildCommand.cs index 6399abd..7aa1a18 100644 --- a/UnityXrefMaps/Commands/BuildCommand.cs +++ b/UnityXrefMaps/Commands/BuildCommand.cs @@ -149,7 +149,7 @@ public BuildCommand(ILoggerFactory loggerFactory) logger.LogInformation("Running DocFX on '{RepositoryTag}'", repositoryTag); } - await Utils.RunCommand( + int exitCode = await Utils.RunCommand( "docfx", docFxArguments, value => { @@ -173,6 +173,18 @@ await Utils.RunCommand( }, cancellationToken); + if (exitCode != 0) + { + result = false; + + if (logger.IsEnabled(LogLevel.Error)) + { + logger.LogError("DocFX exited with code {ExitCode} for Unity '{RepositoryTag}'", exitCode, repositoryTag); + } + + continue; + } + if (!File.Exists(generatedXrefMapPath)) { result = false; diff --git a/UnityXrefMaps/Utils.cs b/UnityXrefMaps/Utils.cs index 8b88a27..6e49723 100644 --- a/UnityXrefMaps/Utils.cs +++ b/UnityXrefMaps/Utils.cs @@ -39,7 +39,7 @@ public static async Task CopyFile(string sourcePath, string destPath, Cancellati /// The arguments of the command. /// The function to call with the output data of the command. /// The function to call with the error data of the command. - public static async Task RunCommand(string command, string arguments, Action output, Action error, CancellationToken cancellationToken = default) + public static async Task RunCommand(string command, string arguments, Action output, Action error, CancellationToken cancellationToken = default) { using var process = new Process(); process.StartInfo = new ProcessStartInfo(command, arguments) @@ -58,6 +58,8 @@ public static async Task RunCommand(string command, string arguments, Action