From a358a63391a6c91971973f99994a1ad9111be518 Mon Sep 17 00:00:00 2001 From: Jonny007-MKD Date: Mon, 6 Apr 2015 20:54:59 +0200 Subject: [PATCH] Better signal handling --- otrDecodeAll | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/otrDecodeAll b/otrDecodeAll index 84e7c86..85500c1 100755 --- a/otrDecodeAll +++ b/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