Fix console runner not working on Windows

This commit is contained in:
Jordan Dominion
2023-08-12 12:46:16 -04:00
parent a21de3f05f
commit 4e2a5836e1
2 changed files with 8 additions and 6 deletions
+5 -2
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
@@ -71,8 +72,10 @@ namespace Tgstation.Server.Host.Console
};
var watchdog = WatchdogFactory.CreateWatchdog(
new PosixSignalChecker(
loggerFactory.CreateLogger<PosixSignalChecker>()),
RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
? new NoopSignalChecker()
: new PosixSignalChecker(
loggerFactory.CreateLogger<PosixSignalChecker>()),
loggerFactory);
return await watchdog.RunAsync(false, arguments.ToArray(), cts.Token)
@@ -2,18 +2,17 @@
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Host.Watchdog;
namespace Tgstation.Server.Host.Service
namespace Tgstation.Server.Host.Watchdog
{
/// <summary>
/// No-op <see cref="ISignalChecker"/>.
/// </summary>
sealed class NoopSignalChecker : ISignalChecker
public sealed class NoopSignalChecker : ISignalChecker
{
/// <inheritdoc />
public Task CheckSignals(Func<string, (int, Task)> startChild, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(startChild);
startChild(null);
return Task.CompletedTask;
}