Fix a ProcessExecutor bug

This commit is contained in:
Jordan Brown
2018-08-18 01:08:52 -04:00
parent 8177a28fc0
commit e0d7bec4f3
@@ -23,7 +23,19 @@ namespace Tgstation.Server.Host.Core
{
handle.EnableRaisingEvents = true;
var tcs = new TaskCompletionSource<int>();
handle.Exited += (a, b) => tcs.SetResult(handle.ExitCode);
handle.Exited += (a, b) =>
{
int exitCode;
try
{
exitCode = handle.ExitCode;
}
catch (InvalidOperationException)
{
return;
}
tcs.SetResult(exitCode);
};
return tcs.Task;
}