4

Fix ctrl-c causing reads of stdin to return empty on Windows. by arlosi · Pull R...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/89433
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Contributor

arlosi commented 20 days ago

Pressing ctrl+c (or ctrl+break) on Windows caused a blocking read of stdin to unblock and return empty, unlike other platforms which continue to block.

On ctrl-c, ReadConsoleW will return success, but also set LastError to ERROR_OPERATION_ABORTED.

This change detects this case, and re-tries the call to ReadConsoleW.

Fixes #89177. See issue for further details.

Tested on Windows 7 and Windows 10 with both MSVC and GNU toolchains


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK