-
Notifications
You must be signed in to change notification settings - Fork 28
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
After the program sends a character, it takes at least 100ms to read it #463
Comments
Hi @lbhzy, thanks for reaching out, this is a well-known issue on winpty-rs: andfoy/winpty-rs#75. (see https://github.com/andfoy/winpty-rs/blob/174030c0f363084935452aeb78e37a0ccb383b59/src/pty/base.rs#L412 for the relevant wait). An user tried to fix it (andfoy/winpty-rs#76), however, the proposed fix caused the PTY process to deadlock, as multiple threads try to access the same pipe natively. Given that such pipes are synchronous in nature, any I/O operation performed from Windows can block (see https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-peeknamedpipe#remarks). An important remark is that using locks won't fix the underlying block. As the regression introduced by the performance improvement caused deadlocks, I decided to rollback the change, and at the moment, the 100ms delay is expected. Recently an update (microsoft/terminal#17510) to add support for overlapped I/O took place in ConPTY, however, the changes at the moment haven't been upstreamed yet, and it could take up to another month to be available (subject to updates). However, we could build ConPTY from scratch, according to https://github.com/microsoft/terminal?tab=readme-ov-file#developer-guidance and bundle it with the library. |
Thank you for your answer,I'll wait for the update to come |
Please reopen for visibility. |
pywinpty dropped support for python 3.8 but all current versions have important issues. - andfoy/pywinpty#463 - andfoy/pywinpty#484 - andfoy/pywinpty#483
I'm writing a terminal emulator, use this library to create a program such as PowerShell,it takes at least 100ms to read the output of PowerShell,this causes the terminal to appear to be stuck when you press and hold the keyboard to send characters continuously.
Is there a way to reduce this time granularity?
My test code:
press and hold the keyboard,result:
The text was updated successfully, but these errors were encountered: