csharp-sdk/tests/Common/Utils/ProcessExtensions.cs
Eirik Tsarpalis aa75f6f37e
Enable netfx testing. (#588)
* Enable netfx testing.

* Skip impacted tests and re-enable netfx testing.

* Remove redundant comment.

* Remove unnecessary project configuration.

* Simplify test server copying.
2025-07-08 18:50:37 +03:00

15 lines
No EOL
487 B
C#

namespace System.Diagnostics;
public static class ProcessExtensions
{
public static async Task WaitForExitAsync(this Process process, TimeSpan timeout)
{
#if NET
using var shutdownCts = CancellationTokenSource.CreateLinkedTokenSource(TestContext.Current.CancellationToken);
shutdownCts.CancelAfter(timeout);
await process.WaitForExitAsync(shutdownCts.Token);
#else
process.WaitForExit(milliseconds: (int)timeout.TotalMilliseconds);
#endif
}
}