-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cancellation on ReadAsync causes next ReadAsync to skip a byte (raw mode) #165
Comments
What's the OS and terminal emulator? |
|
This is on Windows in the Windows Terminal. If I switch to WSL in the same terminal, it works as I'd expect. I also tested Mac, same. So it indeed looks like a bug just on Windows. I can work around it for now by setting up a separate task to read without a timeout into an additional pipe and putting the timeout on reading from that. Separately, I noticed that on Mac/linux, OutLine only does \n but not also \r. I'd expect even on raw mode a higher level function like OutLine to do the "full newline", otherwise I'm not sure what the value of OutLine would be..behavior is surprising anyway. (Feels like the same sort of situation as the \n issue we worked through previously.) |
Ok, I'll investigate next time I boot into Windows.
|
Great idea 👍🏽 |
Ok, I can reproduce it. The behavior here is not encouraging. I modified the repro to print the byte as an integer instead. If I press ❯ dotnet run
1: 0x61
2: cancel
3: 0xb8 Whereas running Cathode's ❯ dotnet run --no-build
Entering raw mode.
0x61
0xc3
0xb8
... So, something is indeed dropping a byte, even one that's part of a single code point, resulting in garbled input. |
Bad news: ❯ dotnet run
1: result=1, error=0, progress=1
0x61
2: result=0, error=995, progress=0
cancel
3: result=1, error=0, progress=1
0xb8 Those are the results of every I don't know if there's actually anything we can do about this. I'm tempted to say that we are, yet again, blocked by microsoft/terminal#12143... |
It might be interesting to note that, if I modify the repro to not perform a third read, pressing |
@scottbilas by the way, can I get you to upvote microsoft/terminal#12143? I need to somehow convince the team that it's worth spending time on fixing, and they seem to use upvotes a lot in their prioritization. |
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?
The text was updated successfully, but these errors were encountered: