summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/basic.bash15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/basic.bash b/src/basic.bash
index a951e0c..a9d0a10 100644
--- a/src/basic.bash
+++ b/src/basic.bash
@@ -63,10 +63,19 @@ trap 'basic::print_stacktrace 0; exit 1' ERR
# Inherit traps on ERR.
set -o errtrace
-# If we didn't trap ERR (and exit on ERR), we'd likely want the below.
+# Exit on ERR.
+# - This is mostly made redundant by the ERR trap (which causes an exit).
+# - However, in some cases, the ERR trap does not apply, while `errexit` does:
+# - `var[0]=(foo bar)`, when not in a subshell.
+# - Same for an associative array.
+# - It is unclear why `errexit` and the ERR trap apply on different
+# conditions.
+# - `inherit_errexit` seems indeed irrelevant in our case, but we enable it
+# for consistency.
# - Note: `inherit_errexit` is similar to `errtrace`.
-#set -o errexit
-#shopt -s inherit_errexit
+# - See also: `/docs/error-handling.md#Array_variables`
+set -o errexit
+shopt -s inherit_errexit
## How to act on exit.