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 <xuyiyang23333@gmail.com>
This commit is contained in:
Xuyiyang23333 2026-05-13 00:37:55 +08:00
parent b9261c4e26
commit c0661024d8

View file

@ -131,7 +131,9 @@ func ShowHelpInPager(text string) {
pager.Stdin = strings.NewReader(text) pager.Stdin = strings.NewReader(text)
pager.Stdout = os.Stdout pager.Stdout = os.Stdout
pager.Stderr = os.Stderr pager.Stderr = os.Stderr
_ = pager.Run() if err := pager.Run(); err != nil {
os.Stdout.WriteString(text)
}
} }
func getDeterministicTimestamp() time.Time { func getDeterministicTimestamp() time.Time {