Merge all trap calls to stop override
This commit is contained in:
20
bootstrap.sh
20
bootstrap.sh
@@ -60,17 +60,29 @@ function ensureBinary() {
|
||||
printSuccess 'done'
|
||||
}
|
||||
|
||||
function main() {
|
||||
function configureTerminal() {
|
||||
if [ -t 0 ]; then
|
||||
trap "stty $(stty -g)" INT TERM EXIT
|
||||
traps+=("stty $(stty -g)")
|
||||
stty -echo
|
||||
fi
|
||||
[ -t 1 ] && tput civis && export TERMINAL_CURSOR_HIDDEN=true
|
||||
|
||||
if [ -t 1 ]; then
|
||||
traps+=('tput cnorm')
|
||||
tput civis
|
||||
export TERMINAL_CURSOR_HIDDEN=true
|
||||
fi
|
||||
}
|
||||
|
||||
function main() {
|
||||
local traps=()
|
||||
local -A colors=() errColors=()
|
||||
defineColors
|
||||
id -Gn | grep admin >&! /dev/null || { printError 'This script requires root access. Please run as an admin user.'; return 10 }
|
||||
|
||||
configureTerminal
|
||||
local tmpdir="`mktemp -d -t 'macos-system'`"
|
||||
isDebug || trap "rm -fr -- '${tmpdir}'; return" INT TERM EXIT
|
||||
isDebug || traps+=("rm -fr -- '${tmpdir}'")
|
||||
trap ${(j.;.)traps} INT TERM EXIT
|
||||
pushd -q "${tmpdir}"
|
||||
print -l "Working directory is: ${tmpdir}"
|
||||
|
||||
|
||||
12
install.sh
12
install.sh
@@ -81,16 +81,22 @@ function checkPrerequisites() {
|
||||
test "`id -u`" -eq 0 || { lop -- -e 'This module requires root access. Please run as root.'; return 11 }
|
||||
}
|
||||
|
||||
function main() {
|
||||
function configureTerminal() {
|
||||
if [ -t 0 ]; then
|
||||
trap "stty $(stty -g)" INT TERM EXIT
|
||||
traps+=("stty $(stty -g)")
|
||||
stty -echo
|
||||
fi
|
||||
if [ -t 1 ]; then
|
||||
trap "tput cnorm" INT TERM EXIT
|
||||
traps+=('tput cnorm')
|
||||
tput civis
|
||||
export TERMINAL_CURSOR_HIDDEN=true
|
||||
fi
|
||||
}
|
||||
|
||||
function main() {
|
||||
local traps=()
|
||||
configureTerminal
|
||||
trap ${(j.;.)traps} INT TERM EXIT
|
||||
autoloadZShLib || return
|
||||
checkPrerequisites || return
|
||||
eval "`docopts -f -V - -h - : "$@" <<- USAGE
|
||||
|
||||
Reference in New Issue
Block a user