aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Diagnostics/CommonProcess.cs
diff options
context:
space:
mode:
authorAndrew Rabert <6550543+nvllsvm@users.noreply.github.com>2019-01-24 22:57:44 -0500
committerGitHub <noreply@github.com>2019-01-24 22:57:44 -0500
commit2c9e056d52840dd98da27a6527fab970150c139f (patch)
tree8af78ab36731a998807633e5b76d26f26de9faed /Emby.Server.Implementations/Diagnostics/CommonProcess.cs
parente05e002b8bb4d13eb2b80b56a0aad8903ddb701e (diff)
parent1d7d4c573875093b97a5929fdee976cd0dcbedea (diff)
Merge pull request #699 from jellyfin/dev
Dev sync
Diffstat (limited to 'Emby.Server.Implementations/Diagnostics/CommonProcess.cs')
-rw-r--r--Emby.Server.Implementations/Diagnostics/CommonProcess.cs18
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));