From b8f7e59246b9f7dfc87cf6ca63fa329cf803a937 Mon Sep 17 00:00:00 2001
From: Luca Bilke <bilke@tralios.de>
Date: Thu, 21 Mar 2024 13:09:36 +0100
Subject: [PATCH] bugfix preview script

---
 .config/lf/preview/preview | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/.config/lf/preview/preview b/.config/lf/preview/preview
index 01cec7a2..d5dbf8e9 100755
--- a/.config/lf/preview/preview
+++ b/.config/lf/preview/preview
@@ -45,12 +45,15 @@ text() {
 run() {
     #shellcheck disable=SC2068
     if ! command -v "$1" >/dev/null 2>&1; then
-        printf "%b" "${RED}Cannot execute $1${RESET}"
+        printf "%b" "${RED}Cannot execute ${1}${RESET}"
         exit 1
-    elif $@; then
+    elif "$@"; then
         exit 1
     else
-        printf "%b" "${RED}Failed to run command: $*${RESET}"
+        printf "%b" "${RED}Failed to run command: ${RESET}"
+        for l in "$@"; do
+            printf "%b" "\n${RED}  ${l}${RESET}"
+        done
         exit 1
     fi
 }