Skip to content

Commit d3222c9

Browse files
authored
Propagate the exception from last retry (#102974)
1 parent c6cebc7 commit d3222c9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/tests/Common/Coreclr.TestWrapper/CoreclrTestWrapperLib.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -306,16 +306,19 @@ static bool CollectCrashDumpWithCreateDump(Process process, string crashDumpPath
306306
else
307307
{
308308
// Workaround for https://github.com/dotnet/runtime/issues/93321
309-
for (int i = 0; i < 5; i++)
309+
const int MaxRetries = 5;
310+
for (int i = 0; i < MaxRetries; i++)
310311
{
311312
try
312313
{
313314
createdump.Kill(entireProcessTree: true);
314315
break;
315316
}
316-
catch (Exception e)
317+
catch (Exception e) when (i < MaxRetries - 1)
317318
{
318-
Console.WriteLine($"Process.Kill(entireProcessTree: true) failed with {e}. Retrying.");
319+
Console.WriteLine($"Process.Kill(entireProcessTree: true) failed:");
320+
Console.WriteLine(e);
321+
Console.WriteLine("Retrying...");
319322
}
320323
}
321324
}

0 commit comments

Comments
 (0)