The Free Software Media System - Server Backend & API
Use WaitForExitAsync extension method in AttachmentExtractor
Mark Monteiro48bbcbb426b1
diff --git a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.csindex c530c9fd81..cb1d8d7bb8 100644--- a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs+++ b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs@@ -166,19 +166,15 @@ namespace MediaBrowser.MediaEncoding.Attachments};var process = new Process{- StartInfo = startInfo+ StartInfo = startInfo,+ EnableRaisingEvents = true};_logger.LogInformation("{File} {Arguments}", process.StartInfo.FileName, process.StartInfo.Arguments);process.Start();- var processTcs = new TaskCompletionSource<bool>();- process.EnableRaisingEvents = true;- process.Exited += (sender, args) => processTcs.TrySetResult(true);- var unregister = cancellationToken.Register(() => processTcs.TrySetResult(process.HasExited));- var ranToCompletion = await processTcs.Task.ConfigureAwait(false);- unregister.Dispose();+ var ranToCompletion = await process.WaitForExitAsync(cancellationToken);if (!ranToCompletion){