Skip to content

Commit 2d9fec3

Browse files
Copilotadamsitnik
andcommitted
Add CancellationToken parameter to CancelDueToProcessExitAsync and pass from callers
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
1 parent dae1fe0 commit 2d9fec3

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/libraries/System.Diagnostics.Process/src/System/Diagnostics/AsyncStreamReader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,12 @@ internal void CancelDueToProcessExit()
268268
}
269269
}
270270

271-
internal async Task CancelDueToProcessExitAsync()
271+
internal async Task CancelDueToProcessExitAsync(CancellationToken cancellationToken)
272272
{
273273
Task? task = _readToBufferTask;
274274
if (task is not null)
275275
{
276-
Task completed = await Task.WhenAny(task, Task.Delay(StreamDrainDefaultTimeoutMs)).ConfigureAwait(false);
276+
Task completed = await Task.WhenAny(task, Task.Delay(StreamDrainDefaultTimeoutMs, cancellationToken)).ConfigureAwait(false);
277277
if (completed != task)
278278
{
279279
_cts.Cancel();

src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,12 +1566,12 @@ async Task CancelStreamReadersDueToProcessExitAsync()
15661566
{
15671567
if (_output is not null)
15681568
{
1569-
await _output.CancelDueToProcessExitAsync().ConfigureAwait(false);
1569+
await _output.CancelDueToProcessExitAsync(cancellationToken).ConfigureAwait(false);
15701570
}
15711571

15721572
if (_error is not null)
15731573
{
1574-
await _error.CancelDueToProcessExitAsync().ConfigureAwait(false);
1574+
await _error.CancelDueToProcessExitAsync(cancellationToken).ConfigureAwait(false);
15751575
}
15761576
}
15771577
}

0 commit comments

Comments
 (0)