Skip to content

redirect should have a target#10835

Merged
sholderbach merged 1 commit intonushell:mainfrom
WindSoilder:redirect_have_target
Oct 25, 2023
Merged

redirect should have a target#10835
sholderbach merged 1 commit intonushell:mainfrom
WindSoilder:redirect_have_target

Conversation

@WindSoilder
Copy link
Copy Markdown
Contributor

@WindSoilder WindSoilder commented Oct 25, 2023

Description

Fixes: #10830

The issue happened during lite-parsing, when we want to put a LiteElement to a LitePipeline, we do nothing if relative redirection target is empty.

So the command echo aaa o> | ignore will be interpreted to echo aaa | ignore.

This pr is going to check and return an error if redirection target is empty.

User-Facing Changes

Before

❯ echo aaa o> | ignore   # nothing happened

After

 echo aaa o> | ignore
Error: nu::parser::parse_mismatch

  × Parse mismatch during operation.
   ╭─[entry #1:1:1]
 1  echo aaa o> | ignore
   ·          ─┬
   ·           ╰── expected redirection target
   ╰────

Copy link
Copy Markdown
Member

@sholderbach sholderbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fast fix and solid testing!

@sholderbach sholderbach merged commit f043a8a into nushell:main Oct 25, 2023
@WindSoilder WindSoilder deleted the redirect_have_target branch October 25, 2023 09:40
hardfau1t pushed a commit to hardfau1t/nushell that referenced this pull request Dec 14, 2023
# Description
Fixes:  nushell#10830 

The issue happened during lite-parsing, when we want to put a
`LiteElement` to a `LitePipeline`, we do nothing if relative redirection
target is empty.

So the command `echo aaa o> | ignore` will be interpreted to `echo aaa |
ignore`.

This pr is going to check and return an error if redirection target is
empty.

# User-Facing Changes
## Before
```
❯ echo aaa o> | ignore   # nothing happened
```

## After
```nushell
❯ echo aaa o> | ignore
Error: nu::parser::parse_mismatch

  × Parse mismatch during operation.
   ╭─[entry #1:1:1]
 1 │ echo aaa o> | ignore
   ·          ─┬
   ·           ╰── expected redirection target
   ╰────
```
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.

Pipe redirection without a target silently does nothing

2 participants