aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Mischievous Meerkat <engineerarun@gmail.com>2020-09-09 00:55:17 +0530
committerGravatar GitHub <noreply@github.com>2020-09-09 00:55:17 +0530
commit578912e75ee44251c661b713b77fb5cafe6ac0e9 (patch)
tree61742bb5ee4afe5883b91590219f5dc02f6a2672
parentd11b07fd01cffe5901ba1cfca148224f1e7f16f0 (diff)
parent858794fd271b3714a8fe65c4dda3de913cce0e31 (diff)
downloadnnn-578912e75ee44251c661b713b77fb5cafe6ac0e9.tar.gz
Merge pull request #725 from 0xACE/previewtab-no-one-left-behind
preview-tabbed now kills lingering viewer
-rwxr-xr-xplugins/preview-tabbed11
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/preview-tabbed b/plugins/preview-tabbed
index 9fefee1..6a55058 100755
--- a/plugins/preview-tabbed
+++ b/plugins/preview-tabbed
@@ -94,6 +94,12 @@ get_viewer_pid () {
VIEWERPID="$(jobs -p %%)"
}
+kill_viewer () {
+ if [ -n "$VIEWERPID" ] && jobs -p | grep "$VIEWERPID" ; then
+ kill "$VIEWERPID"
+ fi
+}
+
previewer_loop () {
unset -v NNN_FIFO
# mute from now
@@ -123,9 +129,7 @@ previewer_loop () {
continue
fi
- if [ -n "$VIEWERPID" ] && jobs -p | grep "$VIEWERPID" ; then
- kill "$VIEWERPID"
- fi
+ kill_viewer
MIME="$(file -b --mime-type "$FILE")"
@@ -188,6 +192,7 @@ previewer_loop () {
fi
done
kill "$TABBEDPID"
+ kill_viewer
}
if [ ! -r "$NNN_FIFO" ] ; then