6 from stgit
.out
import out
10 pager
= _choose_pager()
11 if not sys
.stdin
.isatty() or not sys
.stdout
.isatty() or not pager
:
12 return out
.stdout_bytes(msg
)
14 return _run_pager(pager
, msg
)
17 def _run_pager(pager
, msg
):
18 proc
= subprocess
.Popen(pager
, shell
=True, stdin
=subprocess
.PIPE
)
21 except (KeyboardInterrupt, OSError):
29 except KeyboardInterrupt:
34 for k
in ['GIT_PAGER', 'PAGER', 'MANPAGER']:
35 pager
= os
.environ
.get(k
)
38 for pager
in ['less', 'more']:
39 if shutil
.which(pager
):