nushell / nushell/nushell

Printing anything prevents reading from stdin

Open
#18,033 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:needs-triage
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 14h
Merged PRs (30d)
79

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the reported nu --stdin sample.nu reproducer and compare it with the version where the initial print is removed. Trace the lines and input entry points together with stdout/stderr handling, then verify that input remains readable, lines are processed immediately, EOF is handled cleanly, and the closing message appears.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, shell
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.