Skip to content

Commit

Permalink
RemoteExecutor does not support getting application arguments, Proces…
Browse files Browse the repository at this point in the history
…s.WaitForExitAsync is available only on .NET 7+
  • Loading branch information
adamsitnik committed Feb 13, 2023
1 parent 158e469 commit d3016f2
Showing 1 changed file with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ public enum Signals
[Fact]
public async Task CancellableHandler_is_cancelled_on_process_termination()
{
// the feature is supported on Windows, but it's simply harder to send SIGINT to test it properly
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
// The feature is supported on Windows, but it's simply harder to send SIGINT to test it properly.
// Same for macOS, where RemoteExecutor does not support getting application arguments.
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
await StartKillAndVerify(new[] { "--infiniteDelay", "false" }, Signals.SIGINT, GracefulExitCode);
}
Expand All @@ -39,7 +40,7 @@ public async Task CancellableHandler_is_cancelled_on_process_termination()
[Fact]
public async Task NonCancellableHandler_is_interrupted_on_process_termination()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
await StartKillAndVerify(new[] { "--infiniteDelay", "true" }, Signals.SIGTERM, SIGTERM_EXIT_CODE);
}
Expand Down Expand Up @@ -95,16 +96,9 @@ private async Task StartKillAndVerify(string[] args, Signals signal, int expecte
kill(process.Id, (int)signal).Should().Be(0);

// Verify the process terminates timely
try
{
using CancellationTokenSource cts = new (TimeSpan.FromSeconds(10));
await process.WaitForExitAsync(cts.Token);
}
catch (OperationCanceledException)
if (!process.WaitForExit(TimeSpan.FromSeconds(10)))
{
process.Kill();

throw;
}

// Verify the process exit code
Expand Down

0 comments on commit d3016f2

Please sign in to comment.