Skip to content

Presses of special keys are not detectable by Deno on Windows #5945

@dd-pardal

Description

@dd-pardal

It is currently impossible to know when the user presses a special key in Console Window Host (the default terminal, conhost.exe) or Windows Terminal.

Here's a test script (needs --unstable because of Deno.setRaw()):

const stdinRid = Deno.stdin.rid;
if (Deno.isatty(stdinRid))
    Deno.setRaw(stdinRid, true);

(async () => {
    for await (const data of Deno.iter(Deno.stdin)) {
        if (data[0] === 0x03) // Ctrl+C
            Deno.exit();
        console.log(data);
    }
})();

This could log an escape sequence when the user presses, for example, the arrow keys (I think it does on Linux), but it logs nothing.

Metadata

Metadata

Labels

bugSomething isn't working correctlyclirelated to cli/ dirwindowsRelated to Windows platform

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions