Fix flaky stderr test: call WaitForExit() after WaitForExitAsync() to flush ErrorDataReceived events (#1278)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
This commit is contained in:
parent
f76f6f65c5
commit
3caac28a76
1 changed files with 4 additions and 2 deletions
|
|
@ -72,11 +72,13 @@ internal sealed class StdioClientSessionTransport(
|
|||
try
|
||||
{
|
||||
// The process has exited, but we still need to ensure stderr has been flushed.
|
||||
// WaitForExitAsync only waits for exit; it does not guarantee that all
|
||||
// ErrorDataReceived events have been dispatched. The synchronous WaitForExit()
|
||||
// (no arguments) does ensure that, so call it after WaitForExitAsync completes.
|
||||
#if NET
|
||||
await _process.WaitForExitAsync(cancellationToken).ConfigureAwait(false);
|
||||
#else
|
||||
_process.WaitForExit();
|
||||
#endif
|
||||
_process.WaitForExit();
|
||||
}
|
||||
catch { }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue