Open Artoria2e5 opened 7 years ago
Looks good, but why do ABTYPE=self
never exit when errors occur?
For example, autobuild/build
:
false
echo It should not be here
Is it because set -e
cannot work properly in this scope?
We have a set -e ???????
arch_loadfile_strict have.
It's probably the ||
thing that is breaking set -e
here. Perhaps it should be rewritten into an explicit if (($?)); then ...
Our current error handling for sourced scripts involve testing what is returned from the script itself. For predefined build scripts this works well because we have many return-on-error hooks, but things go wild with poorly-written (read: every single one of)
autobuild/build
scripts.We can either fix all the scripts, or at least partially switch to some "strict mode" handling by
set -ueE
andtrap something ERR
. (Hell, I don't even like how.()
messes up scopes in the first place.) It is, however, still important to note thatset -e
does not properly handle lines with&&
and/or||
. And I also have no idea about how to re-enter the script from an error handler.