Broaden trap() functionality
Resolves #236 and #247 * Broaden trapped signals to SIGHUB, SIGINT, SIGQUIT, SIGABRT * Turn echo back on upon exit. * Provide a newline at exit just to make the terminal look pretty. Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
This commit is contained in:
parent
8356b3231d
commit
446a58f9f3
@ -287,6 +287,14 @@ clean_temp() {
|
|||||||
done
|
done
|
||||||
} # => clean_temp()
|
} # => clean_temp()
|
||||||
|
|
||||||
|
prog_exit() {
|
||||||
|
ESTAT=0
|
||||||
|
[ ! -z "$1" ] && ESTAT=$1
|
||||||
|
(set -o echo 2>/dev/null) || stty echo
|
||||||
|
echo "" # just to get a clean line
|
||||||
|
exit $ESTAT
|
||||||
|
} # => prog_exit()
|
||||||
|
|
||||||
# Make LibreSSL safe config file from OpenSSL config file
|
# Make LibreSSL safe config file from OpenSSL config file
|
||||||
make_ssl_config() {
|
make_ssl_config() {
|
||||||
sed -e "s,ENV::,,g" \
|
sed -e "s,ENV::,,g" \
|
||||||
@ -1318,8 +1326,8 @@ done
|
|||||||
# Intelligent env-var detection and auto-loading:
|
# Intelligent env-var detection and auto-loading:
|
||||||
vars_setup
|
vars_setup
|
||||||
|
|
||||||
# Register clean_temp on EXIT
|
# Register clean_temp and prog_exit on SIGHUP, SIGINT, SIGQUIT, and SIGABRT
|
||||||
trap "clean_temp" EXIT
|
trap "clean_temp; prog_exit" 1 2 3 6
|
||||||
|
|
||||||
# determine how we were called, then hand off to the function responsible
|
# determine how we were called, then hand off to the function responsible
|
||||||
cmd="$1"
|
cmd="$1"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user