From 37de198303a613186a9ca311c59511f21c963dd7 Mon Sep 17 00:00:00 2001 From: johnnybash Date: Sun, 27 Dec 2020 19:27:11 +0100 Subject: [PATCH] use trap to delete the temp files --- plugins/preview-tui | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/preview-tui b/plugins/preview-tui index 6358b4fa..a24ac413 100755 --- a/plugins/preview-tui +++ b/plugins/preview-tui @@ -158,10 +158,11 @@ preview_file () { elif [ "$encoding" = "binary" ]; then if [ "${mimetype%%/*}" = "image" ] || [ "${mimetype%%/*}" = "video" ]; then if [ "${mimetype%%/*}" = "video" ] && [ "$USE_VIDEOTHUMB" -ne 0 ] && exists ffmpegthumbnailer; then - videothumb="/tmp/videothumb.$$.png" - ffmpegthumbnailer -s 0 -i "$1" -o "$videothumb" - set "$videothumb" - fi + videothumb="/tmp/videothumb.$$.png" + ffmpegthumbnailer -s 512 -i "$1" -o "$videothumb" >/dev/null 2>&1 + set "$videothumb" + trap 'rm "$videothumb"' EXIT + fi if [ "$TERMINAL" = "kitty" ]; then # Kitty terminal users can use the native image preview method. kitty +kitten icat --silent --transfer-mode=stream --stdin=no \ @@ -214,7 +215,6 @@ if [ "$PREVIEW_MODE" ] ; then kitty @ last-used-layout --no-response >/dev/null 2>&1 fi - rm $videothumb exit 0 fi