diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs index 4cc913b32ea6cf..8869950c3a44aa 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs @@ -351,7 +351,13 @@ public void ProcessStart_OnLinux_UsesSpecifiedProgram() { try { - Assert.Equal(Program, px.ProcessName); + // ProcessName may transiently reflect the parent's thread name immediately + // after fork() if execve() hasn't completed yet in the child, so retry briefly. + RetryHelper.Execute(() => + { + px.Refresh(); + Assert.Equal(Program, px.ProcessName); + }); } finally { @@ -374,7 +380,13 @@ public void ProcessStart_OnLinux_UsesSpecifiedProgramUsingArgumentList() { try { - Assert.Equal(Program, px.ProcessName); + // ProcessName may transiently reflect the parent's thread name immediately + // after fork() if execve() hasn't completed yet in the child, so retry briefly. + RetryHelper.Execute(() => + { + px.Refresh(); + Assert.Equal(Program, px.ProcessName); + }); } finally {