Skip to content

Override and fire custom FS.stdin #27058

@MateoLa

Description

@MateoLa

I would like to get C++ std::cin calling a custom JS FS.stdin.

I have tried in the main JS thread using emscripten_set_main_loop with a pure vanilla JS as you can see here:
https://github.com/MateoLa/wasm-eg/tree/master/guess/nocomm

I have also tried in the main thread using emscripten_set_main_loop with an es6 module as you can see here:
https://github.com/MateoLa/wasm-eg/tree/master/guess/norun

I have also tried running the es6 module in a background worker, blocking its thread (without emscripten_set_main_loop), as you can see here:
https://github.com/MateoLa/wasm-eg/tree/master/guess/worker

My goal is to port Stockfish which works writing commands to stdin and returning outputs on stdout.

Can you provide a working example about how to override and call a custom FS.stdin function?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions