Skip to content

Printing anything prevents reading from stdin #18033

@tad-lispy

Description

@tad-lispy

Bug report form

  • I have done a basic search of the issue tracker to find any existing issues that are similar.
  • I have checked that my version is at least the latest stable release available via my installation method.

Describe the bug

It's not possible to write to stdout or stderr and then process input line by line. Consider the following:

def main [] {
    print --stderr "Interpreter listening..."
    lines | each { str reverse | print }    
    print --stderr "Interpreter done."
}

The idea to use lines like this comes from #14901. I've also tried using input in a loop, but I can't figure out how to terminate it on EOF.

How to reproduce

Save the above script as sample.nu. Then run it:

$ nu --stdin sample.nu
Interpreter listening...
Interpreter done.

It exits without waiting for the input. Then comment out the first print statement, run it again and see it working correctly.

Expected behavior

The script should print to stderr, then wait for input. Each input line should be immediately printed in reverse. Pressing ctrl-d (or closing the input stream piped from another process) should result in the closing message being printed. After that the script should terminate without any error.

Configuration

key value
version 0.111.0
major 0
minor 111
patch 0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.94.0 (4a4ef493e 2026-03-02) (built from a source tarball)
cargo_version cargo 1.94.0 (85eff7c80 2026-01-15)
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator standard
features default, mcp, network, plugin, rustls-tls, sqlite, trash-support
installed_plugins
experimental_options example=false, reorder-cell-paths=true, pipefail=true, enforce-runtime-annotations=false, native-clip=false

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:needs-triageAn issue that hasn't had any proper look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions