diff options
| author | Tthecreator <tpo.saedt@student.han.nl> | 2019-01-22 16:52:26 +0100 |
|---|---|---|
| committer | Tthecreator <tpo.saedt@student.han.nl> | 2019-01-22 16:52:26 +0100 |
| commit | 0b80902cc81755f7fc80f20a36872882aa202410 (patch) | |
| tree | 53a68daec4c1b16061040b7e9c5495724733707e /Emby.Server.Implementations/Diagnostics/CommonProcess.cs | |
| parent | 189b99df16bd4c93cc96422d7282d01d9ff5b82f (diff) | |
Set EnableRaisingEvents correctly for SubtitleEncoder
Diffstat (limited to 'Emby.Server.Implementations/Diagnostics/CommonProcess.cs')
| -rw-r--r-- | Emby.Server.Implementations/Diagnostics/CommonProcess.cs | 17 |
1 files changed, 7 insertions, 10 deletions
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<bool> 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<bool>(); var cancellationToken = new CancellationTokenSource(timeMs).Token; - if (HasExited) - { - return Task.FromResult(true); - } - _process.Exited += (sender, args) => tcs.TrySetResult(true); cancellationToken.Register(() => tcs.TrySetResult(HasExited)); |
