summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/makepkg.sh.in19
1 files changed, 11 insertions, 8 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index a1385c17..a97cdc28 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -398,20 +398,23 @@ prepare_buildenv() {
}
run_function_safe() {
- local restoretrap
+ local restoretrap restoreset restoreshopt
- set -e
- set -E
+ # we don't set any special shopts of our own, but we don't want the user to
+ # muck with our environment.
+ restoreshopt=$(shopt -p)
+
+ restoreset=$(shopt -o -p)
+ shopt -o -s errexit errtrace
restoretrap=$(trap -p ERR)
- trap 'error_function $pkgfunc' ERR
+ trap "error_function '$1'" ERR
run_function "$1"
- eval $restoretrap
-
- set +E
- set +e
+ eval "$restoretrap"
+ eval "$restoreset"
+ eval "$restoreshopt"
}
run_function() {