From f3444bd0cb90db683ec4021b729b03b81f64ce8e Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Tue, 18 Oct 2022 18:05:16 +0200 Subject: [PATCH] Check for less before calling it --- share/functions/__fish_print_help.fish | 2 +- share/functions/history.fish | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/functions/__fish_print_help.fish b/share/functions/__fish_print_help.fish index d37b1765e..a988ded2b 100644 --- a/share/functions/__fish_print_help.fish +++ b/share/functions/__fish_print_help.fish @@ -133,7 +133,7 @@ function __fish_print_help --description "Print help message for the specified f # similar to man, but add -F to quit paging when the help output is brief (#6227) # Also set -X for less < v530, see #8157. set -l lessopts isRF - if test (less --version | string match -r 'less (\d+)')[2] -lt 530 2>/dev/null + if type -q less; and test (less --version | string match -r 'less (\d+)')[2] -lt 530 2>/dev/null set lessopts "$lessopts"X end diff --git a/share/functions/history.fish b/share/functions/history.fish index 57c3247d5..767207dcf 100644 --- a/share/functions/history.fish +++ b/share/functions/history.fish @@ -95,7 +95,7 @@ function history --description "display or manipulate interactive command histor if not set -qx LESS set -x LESS --quit-if-one-screen # Also set --no-init for less < v530, see #8157. - if test (less --version | string match -r 'less (\d+)')[2] -lt 530 2>/dev/null + if type -q less; and test (less --version | string match -r 'less (\d+)')[2] -lt 530 2>/dev/null set -x LESS $LESS --no-init end end