From 0b80902cc81755f7fc80f20a36872882aa202410 Mon Sep 17 00:00:00 2001 From: Tthecreator Date: Tue, 22 Jan 2019 16:52:26 +0100 Subject: Set EnableRaisingEvents correctly for SubtitleEncoder --- .../Diagnostics/CommonProcess.cs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'Emby.Server.Implementations/Diagnostics/CommonProcess.cs') diff --git a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs index d8a798c46..2fa762c31 100644 --- a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs +++ b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs @@ -106,25 +106,22 @@ namespace Emby.Server.Implementations.Diagnostics return _process.WaitForExit(timeMs); } + public Task WaitForExitAsync(int timeMs) { - //if (_process.WaitForExit(100)) - //{ - // return Task.FromResult(true); - //} + //Note: For this function to work correctly, the option EnableRisingEvents needs to be set to true. + + if (HasExited) + { + return Task.FromResult(true); + } - //timeMs -= 100; timeMs = Math.Max(0, timeMs); var tcs = new TaskCompletionSource(); var cancellationToken = new CancellationTokenSource(timeMs).Token; - if (HasExited) - { - return Task.FromResult(true); - } - _process.Exited += (sender, args) => tcs.TrySetResult(true); cancellationToken.Register(() => tcs.TrySetResult(HasExited)); -- cgit v1.2.3 From cce90d2b56821ca24d65d4851645c0337cb8e88a Mon Sep 17 00:00:00 2001 From: Tthecreator Date: Tue, 22 Jan 2019 19:42:58 +0100 Subject: removed excess newlines --- Emby.Server.Implementations/Diagnostics/CommonProcess.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'Emby.Server.Implementations/Diagnostics/CommonProcess.cs') diff --git a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs index 2fa762c31..55539eafc 100644 --- a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs +++ b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs @@ -105,7 +105,6 @@ namespace Emby.Server.Implementations.Diagnostics { return _process.WaitForExit(timeMs); } - public Task WaitForExitAsync(int timeMs) { -- cgit v1.2.3