Merge pull request #725 from 0xACE/previewtab-no-one-left-behind

preview-tabbed now kills lingering viewer
This commit is contained in:
Mischievous Meerkat 2020-09-09 00:55:17 +05:30 committed by GitHub
commit 578912e75e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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