nushell/tests
Devyn Cairns 5f7afafe51
IR: fix incorrect capturing of subexpressions (#13467)
# Description


[Discovered](https://discord.com/channels/601130461678272522/614593951969574961/1266503282554179604)
by `@warp` on Discord.

The IR compiler was not properly setting redirect modes for
subexpressions because `FullCellPath` was always being compiled with
capture-out redirection. This is the correct behavior if there is a tail
to the `FullCellPath`, as we need the value in order to try to extract
anything from it (although this is unlikely to work) - however, the
parser also generates `FullCellPath`s with an empty tail quite often,
including for bare subexpressions.

Because of this, the following did not behave as expected:

```nushell
(docker run -it --rm alpine)
```

Capturing the output meant that `docker` didn't have direct access to
the terminal as a TTY.

As this is a minor bug fix, it should be okay to include in the 0.96.1
patch release.

# User-Facing Changes

- Fixes the bug as described when running with IR evaluation enabled.

# Tests + Formatting

I added a test for this, though we're not currently running all tests
with IR on the CI, but it should ensure this behaviour is consistent.
The equivalent minimum repro I could find was:

```nushell
(nu --testbin cococo); null
```

as this should cause the `cococo` message to appear on stdout, and if
Nushell is capturing the output, it would be discarded instead.
2024-07-27 19:38:57 -07:00
..
assets/nu_json Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
const_ add raw-string literal support (#9956) 2024-05-02 09:36:37 -04:00
eval Internal representation (IR) compiler and evaluator (#13330) 2024-07-10 17:33:59 -07:00
fixtures Force completers to sort in fetch() (#13242) 2024-07-03 06:48:06 -05:00
hooks Fix hooks on 0.92.0 (#12383) 2024-04-04 09:25:54 +02:00
modules Enable reloading changes to a submodule (#13170) 2024-06-25 18:33:37 -07:00
overlays Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
parsing Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
path Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
plugin_persistence Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
plugins Make plugins able to find and call other commands (#13407) 2024-07-19 13:54:21 +08:00
repl Fix $in in range expressions (#13447) 2024-07-25 18:28:44 +08:00
scope Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
shell IR: fix incorrect capturing of subexpressions (#13467) 2024-07-27 19:38:57 -07:00
main.rs Merged tests to produce a single binary (#12826) 2024-05-13 13:37:53 +00:00