mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-12-14 18:15:44 +00:00
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).
This commit is contained in:
parent
e44611bd25
commit
560c791802
1 changed files with 3 additions and 3 deletions
|
|
@ -213,12 +213,12 @@ public static class FFProbe
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ThrowIfExitCodeNotZero(IProcessResult result, CancellationToken cancellationToken = default)
|
private static void ThrowIfExitCodeNotZero(IProcessResult result, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
if (result.ExitCode != 0)
|
||||||
{
|
{
|
||||||
// if cancellation requested, then we are not interested in the exit code, just throw the cancellation exception
|
// if cancellation requested, then we are not interested in the exit code, just throw the cancellation exception
|
||||||
// to get consistent and expected behavior.
|
// to get consistent and expected behavior.
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
if (result.ExitCode != 0)
|
|
||||||
{
|
|
||||||
var message = $"ffprobe exited with non-zero exit-code ({result.ExitCode} - {string.Join("\n", result.ErrorData)})";
|
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));
|
throw new FFMpegException(FFMpegExceptionType.Process, message, null, string.Join("\n", result.ErrorData));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue