FFMpegCore/FFMpegCore/FFProbe/ProcessArgumentsExtensions.cs
Sergey Nechaev b863f5d19e FFProbe: Do not throw FFMpegException if cancellation was requested.
Throw OperationCancelledException in this case to provide more uniform and expected behavior.

Fixes #594
2025-10-27 13:30:59 +01:00

18 lines
608 B
C#

using Instances;
namespace FFMpegCore;
public static class ProcessArgumentsExtensions
{
public static IProcessResult StartAndWaitForExit(this ProcessArguments processArguments)
{
using var instance = processArguments.Start();
return instance.WaitForExit();
}
public static async Task<IProcessResult> StartAndWaitForExitAsync(this ProcessArguments processArguments, CancellationToken cancellationToken = default)
{
using var instance = processArguments.Start();
return await instance.WaitForExitAsync(cancellationToken).ConfigureAwait(false);
}
}