From 0a50a2194d1d798a831df7eb7f1ff40a40c25dea Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 29 Mar 2016 20:15:47 +0200 Subject: Make cleanup trap more genuine: Really clean-up all created temporary files, make sure the impressive executable gets killed during clean-up. --- debian/changelog | 7 +++++++ impressive-display/bin/impressive-display | 23 ++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 56f2a41..b1c5e57 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +impressive-display (0.2.1) UNRELEASED; urgency=medium + + * Make cleanup trap more genuine: Really clean-up all created temporary + files, make sure the impressive executable gets killed during clean-up. + + -- Mike Gabriel Tue, 29 Mar 2016 20:14:17 +0200 + impressive-display (0.2.0) unstable; urgency=medium * Initial release. diff --git a/impressive-display/bin/impressive-display b/impressive-display/bin/impressive-display index 22a584a..e1f654a 100755 --- a/impressive-display/bin/impressive-display +++ b/impressive-display/bin/impressive-display @@ -159,13 +159,26 @@ if [ -n "$HTTP_PROXY_URL" ]; then fi function cleanup { - if [ -e "$impressive_lock" ]; then - rm "$impessive_lock" - fi - if [ -e "$session_lock" ]; then - rm "$session_lock" + if [ -r "$impressive_lock" ]; then + impressive_pid=$(cat "$impressive_lock" | sed -e 's/[^0-9]*//g') + if [ -n "$impressive_pid" ]; then + kill -0 $impressive_pid 2>/dev/null && kill "$impressive_pid" + fi fi + + for rmfile in $impressive_lock \ + $session_lock \ + $pdffile_previous \ + $pdffile_downloaded \ + $pdffile_display \ + ; + do + if [ -e "$rmfile" ]; then + rm "$rmfile" + fi + done + } function pdf_is_portrait { -- cgit v1.2.3