-
-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
area: driversIssues related to the terminal drivers.Issues related to the terminal drivers.os: windowsIssues that are specific to Windows (10, 11, etc).Issues that are specific to Windows (10, 11, etc).state: blockedIssues that are blocked on some other issue or work.Issues that are blocked on some other issue or work.
Milestone
Description
I'm unsure if this is a bug or I'm using the API wrong, but a canceled ReadAsync causes the next ReadAsync to ignore the next stdin byte, and then behaves normally after that.
To repro, run the below code. Type 'a', wait to allow the cancel, then type 'b' then 'c'. You will see a "c" for step 3, but it should show a "b".
Is there some state that I need to clear after a ReadAsync cancellation?
using static Vezel.Cathode.Terminal;
EnableRawMode();
var buf = new byte[1];
// read key press, works ok
await OutAsync("1: ");
await ReadAsync(buf);
await OutLineAsync((char)buf[0]);
// do a timeout cancel
try
{
var cancel = new CancellationTokenSource();
cancel.CancelAfter(100);
await OutAsync("2: ");
await ReadAsync(buf, cancel.Token);
await OutLineAsync((char)buf[0]);
}
catch (OperationCanceledException)
{
await OutLineAsync("cancel");
}
// this one requires two keypresses
await OutAsync("3: ");
await ReadAsync(buf);
await OutLineAsync((char)buf[0]);
Metadata
Metadata
Assignees
Labels
area: driversIssues related to the terminal drivers.Issues related to the terminal drivers.os: windowsIssues that are specific to Windows (10, 11, etc).Issues that are specific to Windows (10, 11, etc).state: blockedIssues that are blocked on some other issue or work.Issues that are blocked on some other issue or work.