Skip to content

use local scope for private function vars

Lyndon Brown requested to merge jnqnfe/live-build:local_scope into master

note, this builds upon and thus bundles some commits from MRs #112, #115 and #117


all vars affected have been carefully checked to be quite certain that they are definitely local

where variable is assigned the return value of a function/command, the local "declaration" is deliberately done on a separate line, since local FOO is actually treated itself as a command rather than a declaration; will thus always cause $? to be zero, and thus if done on the same line as such an assignment can not only clobber $? but in doing so unintentionally blocks failure of a command from triggering the expected exit from having set -e.

also, from testing, i have found that when assigning "${@}" this must be done on a separate line confusingly as otherwise an error occurs.

i've tried this out in a test run and encountered no issues beyong the "${@}" one just mention which i've addressed.

Merge request reports

Loading