Skip to content

Nushell crashes when alias name is shorter than the command and using pipes #7754

@Xoffio

Description

@Xoffio

Describe the bug

Nushell will crash if the name of the alias is shorter than the command and if the command contains any pipes. Example

add this to your $nu.config-path

# This will crash
 alias ll = ls -l

# This will not crash
alias lalala = ls -la
# This will crash
> ll -a | c
[process exited with code 101 (0x00000065)]
# This will not
| lalala -a | c
cd                   Change directory.
cp                   Copy files.
cal                  Display a calendar.
char                 Output special characters (e.g., 'newline').
...

How to reproduce

add this to your $nu.config-path

# This will crash
 alias ll = ls -l

# This will not crash
alias lalala = ls -la

When you get to the c press tab

# This will crash
> ll -a | c
[process exited with code 101 (0x00000065)]

When you get to the c press tab

# This will not
| lalala -a | c
cd                   Change directory.
cp                   Copy files.
cal                  Display a calendar.
char                 Output special characters (e.g., 'newline').
...

Expected behavior

Not to crash

Screenshots

No response

Configuration

| key                | value                                |
| ------------------ | ------------------------------------ |
| version            | 0.73.0                               |
| branch             |                                      |
| commit_hash        |                                      |
| build_os           | windows-x86_64                       |
| build_target       | x86_64-pc-windows-msvc               |
| rust_version       | rustc 1.66.0 (69f9c33d7 2022-12-12)  |
| rust_channel       | stable-x86_64-pc-windows-msvc        |
| cargo_version      | cargo 1.66.0 (d65d197ad 2022-11-15)  |
| pkg_version        | 0.73.0                               |
| build_time         | 2023-01-05 20:07:27 -05:00           |
| build_rust_channel | release                              |
| features           | database, default, trash, which, zip |
| installed_plugins  |                                      |

Additional context

Thanks to @Windforce17 for discovering the bug
Bug similar to #7648

I already have a code that fixes this issue I am currently testing it

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions