Merge pull request #7405 from keymanapp/chore/common/builder-trap-chained-exit

chore(common): builder script maintenance
This commit is contained in:
Joshua Horton 2022-10-05 15:31:41 +07:00 • committed by GitHub
commit a8d0b540ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View file

@ -5,7 +5,7 @@ set -eu
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
. "$(dirname "$THIS_SCRIPT")/build-utils.sh"
. "$(dirname "$THIS_SCRIPT")/../build-utils.sh"
# END STANDARD BUILD SCRIPT INCLUDE
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
@ -164,9 +164,9 @@ fi
# Due to the nature of the build-utils-traps tests, only one may be
# specified at a time; each ends with an `exit`.
echo "Running separate tests"
$THIS_SCRIPT_PATH/tests/build-utils-traps.test.sh error
$THIS_SCRIPT_PATH/tests/build-utils-traps.test.sh error-in-function
$THIS_SCRIPT_PATH/tests/build-utils-traps.test.sh incomplete
$THIS_SCRIPT_PATH/build-utils-traps.test.sh error
$THIS_SCRIPT_PATH/build-utils-traps.test.sh error-in-function
$THIS_SCRIPT_PATH/build-utils-traps.test.sh incomplete
echo "Fin"
# Finally, run with --help so we can see what it looks like

View file

@ -7,9 +7,9 @@
# * THIS_SCRIPT_PATH defines the full path of the running script
# * THIS_SCRIPT_NAME defines the basename of the running script
# * THIS_SCRIPT_IDENTIFIER defines the repo-relative path of the running script
# * _builder_ functions and variables are internal use only for builder.inc.sh, and
# * _builder_ functions and variables are internal use only for builder.inc.sh, and
# subject to change at any time. Do not use them in other scripts.
# * Note: the running script is the top-level script that includes either
# * Note: the running script is the top-level script that includes either
# builder.inc.sh directly, or, just in the Keyman repo, via build-utils.sh.
#
@ -188,6 +188,11 @@ _builder_failure_trap() {
fi
builder_finish_action failure $action $target
# Make 100% sure that the exit code chains fully.
# Without this, nested scripts have failed to chain errors from npm calls past the script
# that directly executed the failed npm command.
exit $trappedExitCode
fi
}