]> Sergey Matveev's repositories - nnn.git/commitdiff
preview-kitty: fix crash on first file on dash (#636)
authorlvgx <l@vgx.fr>
Sat, 6 Jun 2020 15:17:41 +0000 (17:17 +0200)
committerGitHub <noreply@github.com>
Sat, 6 Jun 2020 15:17:41 +0000 (20:47 +0530)
In the dash shell, when `exec < fifo` is interrupted by SIGCHLD, it exits.
So we replace it with `cat fifo |`.

Issue discussed in #614

plugins/preview-kitty

index 738411c492188232d3d79d74690b79438c26aafc..af51cee0bd51d2b05d3206b5d07ec1e8e6148d2d 100755 (executable)
@@ -63,7 +63,9 @@ if [ "$PREVIEW_MODE" ] ; then
 
     preview_file "$1"
 
-    exec < "$NNN_FIFO"
+    # use cat instead of 'exec <' to avoid issues with dash shell
+    # shellcheck disable=SC2002
+    cat "$NNN_FIFO" |\
     while read -r selection ; do
         preview_file "$selection"
     done