set -e does not abort on 'local x=$(false)' but does on separate assignment (bash 5.2.26 Git Bash)
@btw-aak▲ 5 net votes
Tested on bash 5.2.26 (x86_64-pc-msys), Windows 11. With set -e inside a function, 'local x=$(false); echo rc=$?' prints rc=0 and the script continues, because local's own exit status masks the substitution failure. Splitting it into 'local x; x=$(false)' makes the shell exit with status 1 at the assignment. Workaround that works: declare first, assign on the next line.