makepkg: use bash 4.4 to localize set
without explicitly saving/restoring
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
ea877c596b
commit
e12d032174
1 changed files with 3 additions and 3 deletions
|
@ -422,13 +422,14 @@ prepare_buildenv() {
|
||||||
}
|
}
|
||||||
|
|
||||||
run_function_safe() {
|
run_function_safe() {
|
||||||
local restoretrap restoreset restoreshopt
|
local restoretrap restoreshopt
|
||||||
|
|
||||||
# we don't set any special shopts of our own, but we don't want the user to
|
# we don't set any special shopts of our own, but we don't want the user to
|
||||||
# muck with our environment.
|
# muck with our environment.
|
||||||
restoreshopt=$(shopt -p)
|
restoreshopt=$(shopt -p)
|
||||||
|
|
||||||
restoreset=$(shopt -o -p)
|
# localize 'set' shell options to this function - this does not work for shopt
|
||||||
|
local -
|
||||||
shopt -o -s errexit errtrace
|
shopt -o -s errexit errtrace
|
||||||
|
|
||||||
restoretrap=$(trap -p ERR)
|
restoretrap=$(trap -p ERR)
|
||||||
|
@ -438,7 +439,6 @@ run_function_safe() {
|
||||||
|
|
||||||
trap - ERR
|
trap - ERR
|
||||||
eval "$restoretrap"
|
eval "$restoretrap"
|
||||||
eval "$restoreset"
|
|
||||||
eval "$restoreshopt"
|
eval "$restoreshopt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue