Bug report form
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 |
Bug report form
Describe the bug
It's not possible to write to
stdoutorstderrand 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
lineslike this comes from #14901. I've also tried usinginputin 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:It exits without waiting for the input. Then comment out the first
printstatement, 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. Pressingctrl-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