diff options
author | hut <hut@lepus.uberspace.de> | 2015-10-15 12:57:22 +0200 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2015-10-15 12:57:22 +0200 |
commit | 8a263f02dd3c5b2da4d2ebb0cb0814b9f828cf6c (patch) | |
tree | 60fd8692b4e8b63c7b3edd4088af12edaf30de6d | |
parent | b95b8c619bc91ddd70593d7062a7aaee4a5efb64 (diff) | |
parent | 82ae8743adf352387dd1f3996af1dbe5a25a02a3 (diff) | |
download | ranger-8a263f02dd3c5b2da4d2ebb0cb0814b9f828cf6c.tar.gz |
Merge branch 'scope-safepipe2'
-rwxr-xr-x | ranger/data/scope.sh | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh index 1b4a7b64..afaf131f 100755 --- a/ranger/data/scope.sh +++ b/ranger/data/scope.sh @@ -44,7 +44,7 @@ dump() { /bin/echo "$output"; } trim() { head -n "$maxln"; } # wraps highlight to treat exit code 141 (killed by SIGPIPE) as success -highlight() { command highlight "$@"; test $? = 0 -o $? = 141; } +safepipe() { "$@"; test $? = 0 -o $? = 141; } # Image previews, if enabled in ranger. if [ "$preview_images" = "True" ]; then @@ -91,7 +91,9 @@ esac case "$mimetype" in # Syntax highlight for text files: text/* | */xml) - try highlight --out-format=ansi "$path" && { dump | trim; exit 5; } || exit 2;; + try safepipe highlight --out-format=ansi "$path" && { dump | trim; exit 5; } + try safepipe pygmentize "$path" && { dump | trim; exit 5; } + exit 2;; # Ascii-previews of images: image/*) img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;; |