diff --git a/ILSpy.Tests.Windows/Processes/NetFrameworkProcessesTests.cs b/ILSpy.Tests.Windows/Processes/NetFrameworkProcessesTests.cs index b3982c4a79..185c9bfed9 100644 --- a/ILSpy.Tests.Windows/Processes/NetFrameworkProcessesTests.cs +++ b/ILSpy.Tests.Windows/Processes/NetFrameworkProcessesTests.cs @@ -55,8 +55,10 @@ public void StartADotNetFrameworkProcess() File.Exists(WindowsPowerShellPath).Should().BeTrue( "Windows PowerShell 5.1 is the .NET Framework process this fixture inspects"); + // The host lives exactly as long as the test host process: no wall clock for a slow + // machine to outrun mid-fixture, and no orphan if the teardown never runs. host = Process.Start(new ProcessStartInfo(WindowsPowerShellPath, - "-NoProfile -NonInteractive -Command \"Start-Sleep -Seconds 300\"") { + $"-NoProfile -NonInteractive -Command \"Wait-Process -Id {Environment.ProcessId}\"") { UseShellExecute = false, CreateNoWindow = true, });