Skip to content

Deno.stdin.setRaw() produces "Bad resource ID error" #28867

@DevRubicate

Description

@DevRubicate

Version: Deno 2.2.9

I've boiled the issue down to the smallest reproducible example I could manage:

// Set stdin to raw mode to capture individual key presses
Deno.stdin.setRaw(true);

// Read key presses in a loop
for await (const chunk of Deno.stdin.readable) {
    // Just break the moment we get anything keypress at all
    break;
}

// Turn off raw mode (this will produce an error)
Deno.stdin.setRaw(false);

The error

error: Uncaught (in promise) BadResource: Bad resource ID
Deno.stdin.setRaw(false);
           ^
    at Stdin.setRaw (ext:deno_io/12_io.js:154:5)
    at file:///.../main.ts:11:12
    at eventLoopTick (ext:core/01_core.js:178:7)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions