From c0661024d893ffe623181a960e16fbf642df66ca Mon Sep 17 00:00:00 2001 From: Xuyiyang23333 Date: Wed, 13 May 2026 00:37:55 +0800 Subject: [PATCH] Fix silent failure when pager (less) is not installed When kitten --help is run in a terminal and less is not available, ShowHelpInPager silently discards the error from pager.Run(), resulting in no output and a zero exit code. Fall back to writing help text directly to stdout when the pager fails, matching the behavior of the Python equivalent in kitty/cli.py which catches FileNotFoundError and prints the text as a fallback. Signed-off-by: Xuyiyang23333 --- tools/cli/help.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/cli/help.go b/tools/cli/help.go index 4db7614ca..29a38ef8e 100644 --- a/tools/cli/help.go +++ b/tools/cli/help.go @@ -131,7 +131,9 @@ func ShowHelpInPager(text string) { pager.Stdin = strings.NewReader(text) pager.Stdout = os.Stdout pager.Stderr = os.Stderr - _ = pager.Run() + if err := pager.Run(); err != nil { + os.Stdout.WriteString(text) + } } func getDeterministicTimestamp() time.Time {