The Free Software Media System - Server Backend & API
replace 'try-finally' with 'using' where appropriate
Mark Monteiro658e963e9333
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.csindex e2ca0986bb..4d777081b6 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs@@ -1709,14 +1709,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVprivate void Process_Exited(object sender, EventArgs e){- try- {- var exitCode = ((Process)sender).ExitCode;- _logger.LogInformation("Recording post-processing script completed with exit code {ExitCode}", exitCode);- }- finally+ using (var process = (Process)sender){- ((Process)sender).Dispose();+ _logger.LogInformation("Recording post-processing script completed with exit code {ExitCode}", process.ExitCode);}}diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.csindex 0f2203ca0f..4738272be6 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs@@ -289,8 +289,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV/// </summary>private void OnFfMpegProcessExited(Process process, string inputFile){- try- {+ using (process) {_hasExited = true;_logFileStream?.Dispose();@@ -315,10 +314,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVexitCode)));}}- finally- {- process.Dispose();- }}private async void StartStreamingLog(Stream source, Stream target)