Dispose of process correctly in AttachmentExtractor

pull/2680/head
Mark Monteiro 5 years ago
parent 1c13be085f
commit d705931e81

@ -164,12 +164,11 @@ namespace MediaBrowser.MediaEncoding.Attachments
WindowStyle = ProcessWindowStyle.Hidden,
ErrorDialog = false
};
var process = new Process
{
StartInfo = startInfo,
EnableRaisingEvents = true
};
int exitCode;
using (var process = new Process { StartInfo = startInfo, EnableRaisingEvents = true })
{
_logger.LogInformation("{File} {Arguments}", process.StartInfo.FileName, process.StartInfo.Arguments);
process.Start();
@ -189,9 +188,8 @@ namespace MediaBrowser.MediaEncoding.Attachments
}
}
var exitCode = ranToCompletion ? process.ExitCode : -1;
process.Dispose();
exitCode = ranToCompletion ? process.ExitCode : -1;
}
var failed = false;

Loading…
Cancel
Save