-
-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write "the ultimate guide to errexit" #709
Comments
Off the top of my head, here are the problems:
Related: |
A very related problem is that the e.g. for command subs and process subs. Repeating crazily comprehensive links from Zulip: |
#474 is also very related.
|
There are 4 major problems, which are mostly addressed. And a few minor ones. Addresses issue #709.
I'm not sure if this is really problematic, but one interesting gotcha I encountered today was something to the effect of: set -e
f() { (( var )) && echo foo; }
f
echo bar This doesn't print anything if |
Note also that Whereas |
OK I haven't used errtrace, but it sounds like it's in scope. Do you have an example of your usage? Generally speaking Oil development is very test driven, and I accept PRs with failing spec tests if they pass with other shells (including bash). Example for ble.sh features: https://www.oilshell.org/release/0.8.pre4/test/spec.wwz/ble-idioms.html Either way some examples would help. I generally prioritize features based on "real" usage, since there is a deep well of bash features to go through... |
Sorry for the late response. I think there are two problems there, and I think we should address them. I mentioned The exit code of Oil has a different expression language that doesn't have that confusion and has more types besides integers. But I think |
The main thing I found interesting was that it exited even though |
Yeah I have run into this before and been confused, and it's mentioned on Wooledge's wiki. It happens on code as simple as:
That is better written:
Or use Basically
|
FWIW I changed my style to always use I don't use the |
Frankly, I don't understand how my code works anymore. I do know that:
My startup code looks like:
|
OK thanks, this looks a lot like #708 . It's probably in scope but I don't know all the details of how it works either.... |
Comment listing all the problems concisely: https://news.ycombinator.com/item?id=24740842 This issue is still very important! I have some ideas for it -- I think we need a builtin called |
Quote from HN:
This is the same problem as #2, the Good point! This is not solved by However something like |
Refreshing my memory on what we have:
Although I wasn't entirely happy with the dynamic detection here. It still needs another iteration. Problem: one line functions could still be allowed? The Now what's the solution to the " I think the best answer so far was that when
You can just write it
But it will allow:
I think that makes sense, but we'll have to test it out more to be sure. Comments appreciated! |
Important example: https://news.ycombinator.com/edit?id=24744146 (edit: removed incorrect code) |
OK I think everything here is settled, but we just need to document it ... |
This is finally done ! https://www.oilshell.org/release/0.10.0/doc/error-handling.html --- all pitfalls described here! |
This is going to take a lot of time, but I think it should be done because a lot of these threads are like "groundhog day"
https://lobste.rs/s/ajoaje/first_two_statements_your_bash_script
e.g. discovering
-e
for the first time, then seeing all the problems in the Wooledge Wiki, etc.https://mywiki.wooledge.org/BashFAQ/105
Threads:
https://oilshell.zulipchat.com/#narrow/stream/121540-oil-discuss/topic/Things.20that.20surprised.20me.20about.20shell
https://oilshell.zulipchat.com/#narrow/stream/121540-oil-discuss/topic/more.20errexit.20links
related: #476
The text was updated successfully, but these errors were encountered: