Repository navigation
Make Semicolon stop on error - #6079
Conversation
&& in bash|
I think for externals nu shouldn't show an error |
Agreed, sorry for that I don't have ideas to achieve it, any ideas? I found that if |
|
i'm wondering if external errors are being sent to stderr and nushell just doesn't see it? i.e. if you run this through |
|
for the "2nd part, output by nushell" I don't think we can print an exit code error message unless the user says they want it. Sometimes apps (like I wrote about this a bit: https://www.jntrnr.com/exit-codes/ |
|
Thanks for feedback, mark as draft for now until I get a proper solution |
|
To make it works properly, I have to change
@fdncred It's not captured in latest main |
Thanks for checking. That seems like a bug in another place. Mac must be a little different because I get a different exit code. > ^ls adfadf | complete
ls: cannot access 'adfadf': No such file or directory
╭───────────┬───╮
│ stdout │ │
│ stderr │ │
│ exit_code │ 2 │
╰───────────┴───╯maybe the only way to capture stderr right now is with > do -i { ^ls adsfd | complete }
╭───────────┬──────────────────────────────────────────────────────╮
│ stdout │ │
│ stderr │ ls: cannot access 'adsfd': No such file or directory │
│ │ │
│ exit_code │ 2 │
╰───────────┴──────────────────────────────────────────────────────╯ |
|
I think this is the reason, when repl, nushell/crates/nu-cli/src/util.rs Line 233 in 558cd58 |
I wonder if it should redirect stderr? Let's run with this one for now and see what happens. Thanks! |

Description
Fixes #6022, for the following command:
if
^ls asdfasdfailed,echo donewill never executed again.Here is executing result:

As we can see,
echo doneis not executed.But......Additional note
when external command failed, the relative output can be too verbose, I'm not sure if this is ok:

Tests
Make sure you've done the following:
Make sure you've run and fixed any issues with these commands:
cargo fmt --all -- --checkto check standard code formatting (cargo fmt --allapplies these changes)cargo clippy --workspace --features=extra -- -D warnings -D clippy::unwrap_used -A clippy::needless_collectto check that you're using the standard code stylecargo test --workspace --features=extrato check that all the tests pass