Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion UnityXrefMaps/Commands/BuildCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
{
Expand All @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion UnityXrefMaps/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static async Task CopyFile(string sourcePath, string destPath, Cancellati
/// <param name="arguments">The arguments of the command.</param>
/// <param name="output">The function to call with the output data of the command.</param>
/// <param name="error">The function to call with the error data of the command.</param>
public static async Task RunCommand(string command, string arguments, Action<string?> output, Action<string?> error, CancellationToken cancellationToken = default)
public static async Task<int> RunCommand(string command, string arguments, Action<string?> output, Action<string?> error, CancellationToken cancellationToken = default)
{
using var process = new Process();
process.StartInfo = new ProcessStartInfo(command, arguments)
Expand All @@ -58,6 +58,8 @@ public static async Task RunCommand(string command, string arguments, Action<str
process.BeginErrorReadLine();

await process.WaitForExitAsync(cancellationToken);

return process.ExitCode;
}

/// <summary>
Expand Down
Loading