Skip to content

Ctrl-Z does not work in Windows #19914

Closed
Closed
@lifthrasiir

Description

@lifthrasiir
fn main() {
    for l in std::io::stdin().lock().lines() { println!("{}", l.map(|s| s.escape_unicode())); }
}

As of rustc 0.13.0-nightly (126db549b 2014-12-15 00:07:35 +0000) this does not work: pressing Ctrl-Z then Return (a standard EOF sequence in Windows) simply prints Ok(\x1a\x0d\x0a), and pressing Ctrl-C immediately terminates the process while printing a panic! message.

This is apparently a regression of #3948. According to the relevant code from CPython, ReadConsoleW may return an error ERROR_OPERATION_ABORTED in both cases, and msvcrt (I think) will additionally issue a SIGINT for Ctrl-C within milliseconds. The current code handles none of them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.O-windowsOperating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions