@@ -29,8 +29,9 @@ public enum Signals
29
29
[ Fact ]
30
30
public async Task CancellableHandler_is_cancelled_on_process_termination ( )
31
31
{
32
- // the feature is supported on Windows, but it's simply harder to send SIGINT to test it properly
33
- if ( ! RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
32
+ // The feature is supported on Windows, but it's simply harder to send SIGINT to test it properly.
33
+ // Same for macOS, where RemoteExecutor does not support getting application arguments.
34
+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
34
35
{
35
36
await StartKillAndVerify ( new [ ] { "--infiniteDelay" , "false" } , Signals . SIGINT , GracefulExitCode ) ;
36
37
}
@@ -39,7 +40,7 @@ public async Task CancellableHandler_is_cancelled_on_process_termination()
39
40
[ Fact ]
40
41
public async Task NonCancellableHandler_is_interrupted_on_process_termination ( )
41
42
{
42
- if ( ! RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
43
+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
43
44
{
44
45
await StartKillAndVerify ( new [ ] { "--infiniteDelay" , "true" } , Signals . SIGTERM , SIGTERM_EXIT_CODE ) ;
45
46
}
@@ -95,16 +96,9 @@ private async Task StartKillAndVerify(string[] args, Signals signal, int expecte
95
96
kill ( process . Id , ( int ) signal ) . Should ( ) . Be ( 0 ) ;
96
97
97
98
// Verify the process terminates timely
98
- try
99
- {
100
- using CancellationTokenSource cts = new ( TimeSpan . FromSeconds ( 10 ) ) ;
101
- await process . WaitForExitAsync ( cts . Token ) ;
102
- }
103
- catch ( OperationCanceledException )
99
+ if ( ! process . WaitForExit ( TimeSpan . FromSeconds ( 10 ) ) )
104
100
{
105
101
process . Kill ( ) ;
106
-
107
- throw ;
108
102
}
109
103
110
104
// Verify the process exit code
0 commit comments