Skip to content

Miri stdout is buffered and stdin in always empty #1505

Closed
@RalfJung

Description

@RalfJung

Miri can now read from stdin (thanks to @samrat), but unfortunately stdin is always empty when doing cargo miri run. I think this is because of the way that we are contorting cargo into running Miri -- Miri needs all the compiler flags, so we run cargo check and set RUSTC_WRAPPER to ourselves to dispatch "compiling" the final binary to Miri. cargo thinks it is running a compiler, and does not forward any stdin to it. (Here is a test that should work.)

Similarly, stdout is always buffered, so even if the program flushes stdout, cargo miri run will only print it after the next newline (this is rust-lang/cargo#6641).

@ehuss is there any chance that we could get cargo to invoke Miri in a way that's more like cargo run and less like running a compiler?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargoArea: affects the cargo wrapper (cargo miri)C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions