Compare commits

...

2 commits

Author SHA1 Message Date
Sergey Nechaev
c92cfabc5d
Merge 65cbc5552c into a599c48511 2025-10-24 16:09:45 +00:00
Sergey Nechaev
65cbc5552c Update the ThrowIfExitCodeNotZero() to check the exit code before handling cancellation.
This preserves the original semantics and contract (throw only if the ffprobe exits with a non-zero code).
2025-10-24 18:06:55 +02:00

View file

@ -214,11 +214,11 @@ public static class FFProbe
private static void ThrowIfExitCodeNotZero(IProcessResult result, CancellationToken cancellationToken = default)
{
// if cancellation requested, then we are not interested in the exit code, just throw the cancellation exception
// to get consistent and expected behavior.
cancellationToken.ThrowIfCancellationRequested();
if (result.ExitCode != 0)
{
// if cancellation requested, then we are not interested in the exit code, just throw the cancellation exception
// to get consistent and expected behavior.
cancellationToken.ThrowIfCancellationRequested();
var message = $"ffprobe exited with non-zero exit-code ({result.ExitCode} - {string.Join("\n", result.ErrorData)})";
throw new FFMpegException(FFMpegExceptionType.Process, message, null, string.Join("\n", result.ErrorData));
}