makepkg: don't save the same shopts twice

Both run_function and run_function_safe will save and restore `shopt -p`
but the former is only called from the latter. It makes sense to save
this as part of a "safe" runner, so let's just do it in one place, there
where we save and restore everything else too.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Eli Schwartz 2018-08-13 21:20:57 -04:00 committed by Allan McRae
parent 0696307a3b
commit 48c8f9f2a2

View file

@ -447,9 +447,6 @@ run_function() {
msg "$(gettext "Starting %s()...")" "$pkgfunc" msg "$(gettext "Starting %s()...")" "$pkgfunc"
cd_safe "$srcdir" cd_safe "$srcdir"
# save our shell options so pkgfunc() can't override what we need
local shellopts=$(shopt -p)
local ret=0 local ret=0
if (( LOGGING )); then if (( LOGGING )); then
local fullver=$(get_full_version) local fullver=$(get_full_version)
@ -479,8 +476,6 @@ run_function() {
else else
"$pkgfunc" "$pkgfunc"
fi fi
# reset our shell options
eval "$shellopts"
} }
run_prepare() { run_prepare() {