Skip to content

Commit

Permalink
Fix potential deadlock when cancelling prompts (#1439)
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Jan 31, 2024
1 parent 63c2257 commit 71631b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ internal static async Task<string> ReadLine(this IAnsiConsole console, Style? st

while (true)
{
cancellationToken.ThrowIfCancellationRequested();
var rawKey = await console.Input.ReadKeyAsync(true, cancellationToken).ConfigureAwait(false);
if (rawKey == null)
{
Expand Down
1 change: 1 addition & 0 deletions src/Spectre.Console/Prompts/List/ListPrompt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public ListPrompt(IAnsiConsole console, IListPromptStrategy<T> strategy)

while (true)
{
cancellationToken.ThrowIfCancellationRequested();
var rawKey = await _console.Input.ReadKeyAsync(true, cancellationToken).ConfigureAwait(false);
if (rawKey == null)
{
Expand Down

0 comments on commit 71631b2

Please sign in to comment.