Repository navigation
Closed
Labels
A:error-handlingHow errors in externals/nu code are caught or handled programmatically (see also unhelpful-error)
Description
Describe the bug
I get errors when I chain certain commands. Running the commands separately works fine.
To Reproduce
Steps to reproduce the behavior:
brew update; brew upgradeworks fine.- When I run my full update command:
brew update; brew upgrade; npm update -g; ls ~/code | where type == Dir | each { cd $it.name; git remote -v | autoview; git branch | autoview; git pull --all | autoview; cd ~/code; }; echo y | bit complete; - I get errors like this while the
gitcommands are running:
* master
Error: No such file or directory @ rb_file_s_rename - (/Users/ryanmcquenstockx/Library/Caches/Homebrew/downloads/04ce1a13fff1ee5566cf5bf2e174466e295219fa159b692125d275e1f892ca76--deno--1.11.0.catalina.bottle.tar.gz.incomplete, /Users/ryanmcquenstockx/Library/Caches/Homebrew/downloads/04ce1a13fff1ee5566cf5bf2e174466e295219fa159b692125d275e1f892ca76--deno--1.11.0.catalina.bottle.tar.gz)
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 12 (delta 7), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (12/12), done.
Expected behavior
This worked fine in 0.30.0.
Configuration (please complete the following information):
Run version | pivot and paste the output to show OS, features, etc.
λ version | pivot
───┬────────────────────┬─────────────────────────────────────────────────────────────────────
# │ Column0 │ Column1
───┼────────────────────┼─────────────────────────────────────────────────────────────────────
0 │ version │ 0.32.0
1 │ build_os │ macos-x86_64
2 │ rust_version │ rustc 1.51.0
3 │ cargo_version │ cargo 1.51.0
4 │ pkg_version │ 0.32.0
5 │ build_time │ 2021-06-01 21:00:59
6 │ build_rust_channel │ release
7 │ features │ clipboard-cli, ctrlc, default, directories, dirs, ptree, rustyline,
│ │ term, trash, uuid, which, zip
───┴────────────────────┴─────────────────────────────────────────────────────────────────────
Metadata
Metadata
Assignees
Labels
A:error-handlingHow errors in externals/nu code are caught or handled programmatically (see also unhelpful-error)
Activity
ryanpcmcquen commentedon Jun 9, 2021
The
Errorline isbrewfailing to execute in some weird way, which I cannot reproduce when the command is isolated.ryanpcmcquen commentedon Jun 9, 2021
I think it may be related to what I reported here: #3447
fdncred commentedon Jun 9, 2021
What should be the proper option when something fails in a pipeline like this?
Maybe this could be controlled by an env var?
ryanpcmcquen commentedon Jun 9, 2021
This is what I would expect coming from Bash. The main issue here is that it is creating errors because of the execution context ...
ryanpcmcquen commentedon Jun 9, 2021
In Bash if you want it to stop on failure you would do
&&for chaining, rather than the;. Not sure ifnushellintends to have the same kind of distinction.sophiajt commentedon Jun 9, 2021
;in nushell should be equivalent to Bash's&&. In Nushell, we use&&for boolean conditions likeif this && that { ... }.fdncred commentedon Jun 9, 2021
it sounds like @jonathandturner is saying that, when using
;, and an external returns non-zero, then we should stop processing entirely showing that error.I think we'd need to capture return codes, which I think we tried before but perhaps reverted because not all externals are compliant with non-zero errors or 0 success. I'd like to see nushell capture error codes once again, if only to report it for things like starship. But I'm also not sure how to handle non-compliant externals.
sounds like a great job for you @ryanpcmcquen LOL j/k. :)
fdncred commentedon Jun 9, 2021
Hey @ryanpcmcquen. What happens if you use this root config.toml value?
nonzero_exit_errors = trueDoes it change the way your errors work?ryanpcmcquen commentedon Jun 9, 2021
I cannot reproduce the error with that setting. Although it does make the shell think one of the update commands is failing.
fdncred commentedon Jun 9, 2021
you can see what is going on here. apparently something is returning a non-zero value.
github-actions commentedon Jul 10, 2021
This issue is being marked stale because it has been open for 30 days without activity. If you feel that this is in error, please comment below and we will keep it marked as active.
github-actions commentedon Oct 9, 2021
This issue is being marked stale because it has been open for 90 days without activity. If you feel that this is in error, please comment below and we will keep it marked as active. Otherwise, it will be closed in 10 days.
sholderbach commentedon Dec 1, 2022
Just wanted to check-in if this still fails unexpectedly? We should stop on errors in a
;chain now. (It basically replaces&&in bash. And with 0.72 we introducedtry/catchas a more explicit substitute for||in bashsophiajt commentedon Aug 9, 2023
Closing as no-repro as we've done a lot of improvements to
;since this was filed.Please re-open if the issue returns.