Skip to content

Output is different when connected to a shell vs a pipe #7833

@aykevl

Description

@aykevl

wasmtime has a different output depending on whether it is run normally or through a pipe (for example, tail).

Test Case

See the wasm.test file here:
wasm-test.zip

Steps to Reproduce

Normal case:

$ wasmtime run test.wasm
line written using C puts
hello world!

Output is redirected to a pipe:

$ wasmtime run test.wasm | tail
line written using C puts

For comparison, I tested the same thing in wasmer and it has the correct (first) output in both cases.

Expected Results

Output should be the same, regardless of where stdout is redirected.

Actual Results

The last line is somehow lost when stdout is redirected to a pipe (in this case, passing it to tail but I've also seen this issue when running from inside Go os/exec).

Versions and Environment

Wasmtime version or commit: wasmtime-cli 17.0.0

Operating system: Linux (Fedora Asahi)

Architecture: aarch64

Extra Info

This is a relatively big test case, I can try to make it smaller if needed.
For example, I've found it reproducible using fwrite("test\n", 5, 1, stdout);.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions