chore: Add cancellation support for PdfBuilder operation #10460
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR intended to fix issue #9870.
Currently when running
docfx pdf
command.Ctrl+C
command interruption is not accepted.So I've added codes to manually cancel running operations.
Note
Playwright don't supports cancellationToken parameters.
So it need manually cancel operation by dispose playwright context.
Specre.Console
don't support native cancellation support .So PdfCommand/DefaultCommand is not modified. (It need to migrate to
AsyncCommand
in future)https://github.com/spectreconsole/spectre.console/issues/701
What's changed in this PR
Console.CancelKeyPress
event handlers to cancel running operationscancellationToken
parameter to following methods3.1. WebApplication.Start
3.2.
ParallelOptions
parameter ofParallel.Foreach
cancellationToken.ThrowIfCancellationRequested()
inside loop.outputPath
parameter topdfOutputPath
.