mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 08:26:56 +00:00
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:
parent
b9261c4e26
commit
c0661024d8
1 changed files with 3 additions and 1 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue