|
@@ -164,34 +164,32 @@ namespace MediaBrowser.MediaEncoding.Attachments
|
|
WindowStyle = ProcessWindowStyle.Hidden,
|
|
WindowStyle = ProcessWindowStyle.Hidden,
|
|
ErrorDialog = false
|
|
ErrorDialog = false
|
|
};
|
|
};
|
|
- var process = new Process
|
|
|
|
- {
|
|
|
|
- StartInfo = startInfo,
|
|
|
|
- EnableRaisingEvents = true
|
|
|
|
- };
|
|
|
|
|
|
|
|
- _logger.LogInformation("{File} {Arguments}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
|
|
|
|
|
+ int exitCode;
|
|
|
|
|
|
- process.Start();
|
|
|
|
|
|
+ using (var process = new Process { StartInfo = startInfo, EnableRaisingEvents = true })
|
|
|
|
+ {
|
|
|
|
+ _logger.LogInformation("{File} {Arguments}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
|
|
|
|
|
- var ranToCompletion = await process.WaitForExitAsync(cancellationToken);
|
|
|
|
|
|
+ process.Start();
|
|
|
|
|
|
- if (!ranToCompletion)
|
|
|
|
- {
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- _logger.LogWarning("Killing ffmpeg attachment extraction process");
|
|
|
|
- process.Kill();
|
|
|
|
- }
|
|
|
|
- catch (Exception ex)
|
|
|
|
|
|
+ var ranToCompletion = await process.WaitForExitAsync(cancellationToken);
|
|
|
|
+
|
|
|
|
+ if (!ranToCompletion)
|
|
{
|
|
{
|
|
- _logger.LogError(ex, "Error killing attachment extraction process");
|
|
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ _logger.LogWarning("Killing ffmpeg attachment extraction process");
|
|
|
|
+ process.Kill();
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex)
|
|
|
|
+ {
|
|
|
|
+ _logger.LogError(ex, "Error killing attachment extraction process");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- var exitCode = ranToCompletion ? process.ExitCode : -1;
|
|
|
|
|
|
|
|
- process.Dispose();
|
|
|
|
|
|
+ exitCode = ranToCompletion ? process.ExitCode : -1;
|
|
|
|
+ }
|
|
|
|
|
|
var failed = false;
|
|
var failed = false;
|
|
|
|
|