mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
use trap to delete the temp files
This commit is contained in:
parent
4d77066b62
commit
37de198303
|
@ -159,8 +159,9 @@ preview_file () {
|
||||||
if [ "${mimetype%%/*}" = "image" ] || [ "${mimetype%%/*}" = "video" ]; then
|
if [ "${mimetype%%/*}" = "image" ] || [ "${mimetype%%/*}" = "video" ]; then
|
||||||
if [ "${mimetype%%/*}" = "video" ] && [ "$USE_VIDEOTHUMB" -ne 0 ] && exists ffmpegthumbnailer; then
|
if [ "${mimetype%%/*}" = "video" ] && [ "$USE_VIDEOTHUMB" -ne 0 ] && exists ffmpegthumbnailer; then
|
||||||
videothumb="/tmp/videothumb.$$.png"
|
videothumb="/tmp/videothumb.$$.png"
|
||||||
ffmpegthumbnailer -s 0 -i "$1" -o "$videothumb"
|
ffmpegthumbnailer -s 512 -i "$1" -o "$videothumb" >/dev/null 2>&1
|
||||||
set "$videothumb"
|
set "$videothumb"
|
||||||
|
trap 'rm "$videothumb"' EXIT
|
||||||
fi
|
fi
|
||||||
if [ "$TERMINAL" = "kitty" ]; then
|
if [ "$TERMINAL" = "kitty" ]; then
|
||||||
# Kitty terminal users can use the native image preview method.
|
# Kitty terminal users can use the native image preview method.
|
||||||
|
@ -214,7 +215,6 @@ if [ "$PREVIEW_MODE" ] ; then
|
||||||
kitty @ last-used-layout --no-response >/dev/null 2>&1
|
kitty @ last-used-layout --no-response >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm $videothumb
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue