mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 15:07:03 +01:00
Catch occasional InvalidOperationException in Session lifetimeTask
This commit is contained in:
@@ -57,8 +57,16 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
return result;
|
||||
}, default, TaskCreationOptions.LongRunning, TaskScheduler.Current);
|
||||
lifetimeTask = new TaskCompletionSource<int>();
|
||||
process.EnableRaisingEvents = true;
|
||||
process.Exited += (a, b) => lifetimeTask.SetResult(process.ExitCode);
|
||||
try
|
||||
{
|
||||
process.EnableRaisingEvents = true;
|
||||
process.Exited += (a, b) => lifetimeTask.TrySetResult(process.ExitCode);
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
//dead proccess
|
||||
lifetimeTask.TrySetResult(process.ExitCode);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user