Skip to content

Error on out> redirect on branched block #16582

@fixerer

Description

@fixerer

Running an output redirect (eg out> /dev/null) after a conditional block gives the following error:

Error: nu::shell::ir_eval_error

  × IR evaluation error: Tried to write to file #0, but it is not open
   ╭─[entry #286:1:36]
 1 │ if true {echo hey} else { echo ho} o> /dev/null
   ·                                    ─┬
   ·                                     ╰── while running this code
   ╰────
  help: this is a bug, please report it...

Note that the file does get created and written to, even when the error occurs.

The simplest code for reproduction is: if true { echo hey } out> /dev/null

Note that the same issue exists for try { 1/0 } catch { 'ono' } o> /dev/null

This is observed on nu --version = 0.105.1 (on nixos installation).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:ir-compilerIssues/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 STDERRcategory:bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions