Skip to content

Commit ac56679

Browse files
committed
Add other scenarios to tests
1 parent 078512a commit ac56679

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/System.CommandLine.Tests/Invocation/CancelOnProcessTerminationTests.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ public async Task CancelOnProcessTermination_cancels_on_process_termination(int
9292
}
9393

9494
[LinuxOnlyTheory]
95-
[InlineData(null)]
96-
[InlineData(100)]
97-
public async Task CancelOnProcessTermination_timeout_on_cancel_processing(int? timeOutMs)
95+
[InlineData(null, SIGINT)]
96+
[InlineData(100, SIGINT)]
97+
[InlineData(null, SIGTERM)]
98+
[InlineData(100, SIGTERM)]
99+
public async Task CancelOnProcessTermination_timeout_on_cancel_processing(int? timeOutMs, int signo)
98100
{
99101
TimeSpan? timeOut = timeOutMs.HasValue ? TimeSpan.FromMilliseconds(timeOutMs.Value) : null;
100102

@@ -126,7 +128,7 @@ public async Task CancelOnProcessTermination_timeout_on_cancel_processing(int? t
126128
// and we're no longer actively blocking the event.
127129
// The event handler is responsible to continue blocking until the command
128130
// has finished executing. If it doesn't we won't get the CancelledExitCode.
129-
await Task.Delay(TimeSpan.FromMilliseconds(5000));
131+
await Task.Delay(TimeSpan.FromMilliseconds(2000));
130132

131133
context.ExitCode = CancelledExitCode;
132134
}
@@ -151,7 +153,7 @@ public async Task CancelOnProcessTermination_timeout_on_cancel_processing(int? t
151153
childState.Should().Be(ChildProcessWaiting);
152154

153155
// Request termination
154-
kill(process.Id, /*SIGTERM*/ SIGINT).Should().Be(0);
156+
kill(process.Id, signo).Should().Be(0);
155157

156158
// Verify the process terminates timely
157159
bool processExited = process.WaitForExit(10000);

0 commit comments

Comments
 (0)