-
Notifications
You must be signed in to change notification settings - Fork 2.1k
IR evaluation error when redirecting parenthesized expression to a file #15326
Copy link
Copy link
Closed
Labels
A:ir-compilerIssues/pull requests related to compiling Nushell parser output to internal representation (IR)Issues/pull requests related to compiling Nushell parser output to internal representation (IR)A:redirection-pipeAll related to redirection to files or more complex pipelines with STDERRAll related to redirection to files or more complex pipelines with STDERRcategory:bugSomething isn't workingSomething isn't workingstatus:investigatethis requires investigationthis requires investigation
Milestone
Description
Describe the bug
When an expression wrapped in parentheses is redirected to a file, then an IR evaluation error is returned:
$ (let s = "test"; $s) o> out.txt; open out.txt
Error: nu::shell::ir_eval_error
× IR evaluation error: Tried to write to file #0, but it is not open
╭─[entry #25:1:22]
1 │ (let s = "test"; $s) o> out.txt; open out.txt
· ─┬
· ╰── while running this code
╰────
help: this is a bug, please report it at https://github.com/nushell/nushell/issues/new along with the code you
were running if ableRemoving the parentheses fixes the problem:
$ let s = "test"; $s o> out.txt; open out.txt
testThis bug doesn't occur in Nushell below version 0.98.0, although that's probably because that particular version changed IR to be the default evaluator.
How to reproduce
Run the following:
let text = "hello\nworld"
($text | head -n 1; $text | tail -n 1) o> out.txtThis code is taken from the Nushell documentation, it's the last example in the File Redirections section.
Expected behavior
There should be no IR evaluation error.
Configuration
| key | value |
|---|---|
| version | 0.102.0 |
| major | 0 |
| minor | 102 |
| patch | 0 |
| branch | |
| commit_hash | |
| build_os | macos-x86_64 |
| build_target | x86_64-apple-darwin |
| rust_version | rustc 1.84.1 (e71f9a9a9 2025-01-27) (Homebrew) |
| cargo_version | cargo 1.84.1 |
| build_time | 2025-02-04 15:49:35 +00:00 |
| build_rust_channel | release |
| allocator | mimalloc |
| features | default, sqlite, trash |
| installed_plugins |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A:ir-compilerIssues/pull requests related to compiling Nushell parser output to internal representation (IR)Issues/pull requests related to compiling Nushell parser output to internal representation (IR)A:redirection-pipeAll related to redirection to files or more complex pipelines with STDERRAll related to redirection to files or more complex pipelines with STDERRcategory:bugSomething isn't workingSomething isn't workingstatus:investigatethis requires investigationthis requires investigation