diff options
| author | Andrew Rabert <6550543+nvllsvm@users.noreply.github.com> | 2019-01-22 19:31:33 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-22 19:31:33 -0500 |
| commit | 52dd570142b20b48e41c335c3e8e6891b309a830 (patch) | |
| tree | 432dbd921ca780c5486f50459f552180f2af18e4 /Emby.Server.Implementations/Diagnostics/CommonProcess.cs | |
| parent | 28483bdb54be96ae83e0fded097f534d7e26ba1e (diff) | |
| parent | cce90d2b56821ca24d65d4851645c0337cb8e88a (diff) | |
Merge pull request #671 from Tthecreator/dev
Set EnableRaisingEvents correctly
Diffstat (limited to 'Emby.Server.Implementations/Diagnostics/CommonProcess.cs')
| -rw-r--r-- | Emby.Server.Implementations/Diagnostics/CommonProcess.cs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs index d8a798c46..55539eafc 100644 --- a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs +++ b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs @@ -105,26 +105,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)); |
