console-rs / console-rs/console

mintty read_key fails with "Incorrect function"

Open
#35 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help-wanted
Dominant language
Rust
Stars
1.2k
Forks
144
Avg merge
8h 24m
Merged PRs (30d)
4

Description

use console::Term;
fn main() {
    let term = Term::stdout();
    let result = term.read_key();
    match result {
        Ok(k) => println!("Key: {:?}", k),
        Err(e) => println!("Error: {:?}", e),
    };
}

Running this code using mintty. Ran this code using msys and mingw. When running though the integrated terminal in visual studio code the code passes. When running it on mintty it fails with the line

Error: Os { code: 1, kind: Other, message: "Incorrect function." }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example using mintty under MSYS or MinGW, then compare it with the integrated Visual Studio Code terminal. Start at the Term::stdout().read_key() entry point and investigate why mintty returns Windows error code 1; done means read_key handles mintty input successfully without regressing the working terminal case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.