File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 77- Improve native man pages and command help syntax highlighting by stripping overstriking, see #3517 (@akirk )
88
99## Bugfixes
10+ - Fix pager spawn detection under QEMU user-mode emulation. See #3531 (@OctopusET )
1011- ` --help ` now correctly honors ` --pager=builtin ` . See #3516 (@keith-hall )
1112- ` --help ` now correctly honors custom themes. See #3524 (@keith-hall )
1213
Original file line number Diff line number Diff line change @@ -113,6 +113,10 @@ impl OutputType {
113113 let args = pager. args ;
114114
115115 if pager. kind == PagerKind :: Less {
116+ if retrieve_less_version ( & pager. bin ) . is_none ( ) {
117+ return Ok ( OutputType :: stdout ( ) ) ;
118+ }
119+
116120 // less needs to be called with the '-R' option in order to properly interpret the
117121 // ANSI color sequences printed by bat. If someone has set PAGER="less -F", we
118122 // therefore need to overwrite the arguments and add '-R'.
@@ -166,10 +170,13 @@ impl OutputType {
166170 p. args ( args) ;
167171 } ;
168172
169- Ok ( p. stdin ( Stdio :: piped ( ) )
170- . spawn ( )
171- . map ( OutputType :: Pager )
172- . unwrap_or_else ( |_| OutputType :: stdout ( ) ) )
173+ Ok ( match p. stdin ( Stdio :: piped ( ) ) . spawn ( ) {
174+ Ok ( mut child) => match child. try_wait ( ) {
175+ Ok ( Some ( status) ) if !status. success ( ) => OutputType :: stdout ( ) ,
176+ _ => OutputType :: Pager ( child) ,
177+ } ,
178+ Err ( _) => OutputType :: stdout ( ) ,
179+ } )
173180 }
174181
175182 pub ( crate ) fn stdout ( ) -> Self {
You can’t perform that action at this time.
0 commit comments