mirror of
https://github.com/Jonny007-MKD/OTR-DecodeAll
synced 2025-01-22 08:49:50 +01:00
Better signal handling
This commit is contained in:
parent
ce9e673076
commit
a358a63391
1 changed files with 17 additions and 4 deletions
21
otrDecodeAll
21
otrDecodeAll
|
@ -29,12 +29,25 @@ PwD=$(dirname "$PwD")
|
|||
# Helper functions #
|
||||
####################
|
||||
|
||||
# trap ctrl-c and call ctrl_c()
|
||||
trap ctrl_c INT
|
||||
# trap signals and handle them
|
||||
trap t_sigint SIGINT # Ctrl+C
|
||||
trap t_sighup SIGHUP # Hangup on Terminal
|
||||
trap t_sigcont SIGCONT # Continue after stop
|
||||
|
||||
function ctrl_c() {
|
||||
function t_sigint {
|
||||
funcUnlock
|
||||
exit
|
||||
exit 2
|
||||
}
|
||||
|
||||
function t_sighup {
|
||||
# Do nothing
|
||||
sleep 0
|
||||
}
|
||||
|
||||
function t_sigcont {
|
||||
if [ -n "$lastProcessingEcho" ]; then
|
||||
echo -e "$lastProcessingEcho"
|
||||
fi
|
||||
}
|
||||
|
||||
# Log message to stdout and log file
|
||||
|
|
Loading…
Reference in a new issue