public void SignalHandlerCalledForKnownSignals(PosixSignal s)
        {
            RemoteExecutor.Invoke(signalStr =>
            {
                PosixSignal signal = Enum.Parse <PosixSignal>(signalStr);

                using SemaphoreSlim semaphore = new(0);
                using var _ = PosixSignalRegistration.Create(signal, ctx =>
                {
                    Assert.Equal(signal, ctx.Signal);

                    // Ensure signal doesn't cause the process to terminate.
                    ctx.Cancel = true;

                    semaphore.Release();
                });

                // Use 'kill' command with signal name to validate the signal pal mapping.
                string sigArg     = signalStr.StartsWith("SIG") ? signalStr.Substring(3) : signalStr;
                using var process = Process.Start(new ProcessStartInfo
                {
                    FileName     = "/bin/sh", // Use a shell because not all platforms include a 'kill' executable.
                    ArgumentList = { "-c", $"kill -s {sigArg} {Environment.ProcessId.ToString()}" }
                });
                process.WaitForExit();
                Assert.Equal(0, process.ExitCode);

                bool entered = semaphore.Wait(SuccessTimeout);
                Assert.True(entered);
            }, s.ToString()).Dispose();
        }
        public void SignalHandlerCalledForRawSignals(PosixSignal s)
        {
            RemoteExecutor.Invoke((signalStr) =>
            {
                PosixSignal signal = Enum.Parse <PosixSignal>(signalStr);

                using SemaphoreSlim semaphore = new(0);
                using var _ = PosixSignalRegistration.Create(signal, ctx =>
                {
                    Assert.Equal(signal, ctx.Signal);

                    // Ensure signal doesn't cause the process to terminate.
                    ctx.Cancel = true;

                    semaphore.Release();
                });

                kill(signal);
                bool entered = semaphore.Wait(SuccessTimeout);
                Assert.True(entered);
            }, s.ToString()).Dispose();
        }