Skip to content

Add note about issue #15326#1876

Merged
132ikl merged 3 commits intonushell:mainfrom
132ikl:pipelines-note
Apr 13, 2025
Merged

Add note about issue #15326#1876
132ikl merged 3 commits intonushell:mainfrom
132ikl:pipelines-note

Conversation

@132ikl
Copy link
Copy Markdown
Member

@132ikl 132ikl commented Apr 13, 2025

A couple people have made issues about this broken example, so adding a note here that it's broken until nushell/nushell#15326 is fixed

Not sure if this is bad form, but seems better than removing the examples for now and hoping someone remembers to re-add them (cc @NotTheDr01ds)

Rel: nushell/nushell#15561, nushell/nushell#15416

@NotTheDr01ds
Copy link
Copy Markdown
Contributor

I agree - Now let's just hope someone remembers to remove the comment once it's fixed :-)

@132ikl 132ikl merged commit a9800e6 into nushell:main Apr 13, 2025
2 checks passed
sholderbach added a commit to nushell/nushell that referenced this pull request Apr 24, 2025
# Description
Try to fixes #15326 in another
way.

The main point of this change is to avoid duplicate `write` and `close`
a redirected file. So during compile, if compiler know current element
is a sub-expression(defined by private `is_subexpression` function), it
will no longer invoke `finish_redirection`.

In this way, we can avoid duplicate `finish_redirection`.

# User-Facing Changes
`(^echo aa) o> /tmp/aaa` will no longer raise an error.

Here is the IR after the pr:
```
# 3 registers, 12 instructions, 11 bytes of data
# 1 file used for redirection
   0: load-literal           %1, string("aaa")
   1: open-file              file(0), %1, append = false
   2: load-literal           %1, glob-pattern("echo", no_expand = false)
   3: load-literal           %2, glob-pattern("true", no_expand = false)
   4: push-positional        %1
   5: push-positional        %2
   6: redirect-out           file(0)
   7: redirect-err           caller
   8: call                   decl 135 "run-external", %0
   9: write-file             file(0), %0
  10: close-file             file(0)
  11: return                 %0
```

# Tests + Formatting
Added 3 tests.

# After Submitting
Maybe need to update doc
nushell/nushell.github.io#1876

---------

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
WindSoilder added a commit to nushell/nushell that referenced this pull request Apr 25, 2025
…tor (#15623)

# Description
Fixes: #15510
I think it's introduced by #14653, which changes `and/or` to `match`
expression.

After looking into `compile_match`, it's important to collect the value
before matching this.
```rust
    // Important to collect it first
    builder.push(Instruction::Collect { src_dst: match_reg }.into_spanned(match_expr.span))?;
```
This pr is going to apply the logic while compiling `and/or` operation.

# User-Facing Changes
The following will raise a reasonable error:
```nushell
> (nu --testbin cococo false) and true
Error: nu::shell::operator_unsupported_type

  × The 'and' operator does not work on values of type 'string'.
   ╭─[entry #7:1:2]
 1 │ (nu --testbin cococo false) and true
   ·  ─┬                         ─┬─
   ·   │                          ╰── does not support 'string'
   ·   ╰── string
   ╰────
```

# Tests + Formatting
Added 1 test.

# After Submitting
Maybe need to update doc
nushell/nushell.github.io#1876

---------

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants