mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-14 01:26:23 +01:00
Fix less pager by adding '-R' to LESS env
This commit is contained in:
parent
001bbdf365
commit
56747274d3
12
osc/core.py
12
osc/core.py
@ -4401,11 +4401,21 @@ def run_pager(message, tmp_suffix=''):
|
|||||||
else:
|
else:
|
||||||
tmpfile.write(message)
|
tmpfile.write(message)
|
||||||
tmpfile.flush()
|
tmpfile.flush()
|
||||||
|
|
||||||
|
env = os.environ.copy()
|
||||||
|
|
||||||
pager = os.getenv("PAGER", default="").strip()
|
pager = os.getenv("PAGER", default="").strip()
|
||||||
pager = pager or get_default_pager()
|
pager = pager or get_default_pager()
|
||||||
|
|
||||||
|
# LESS env is not always set and we need -R to display escape sequences properly
|
||||||
|
less_opts = os.getenv("LESS", default="")
|
||||||
|
if "-R" not in less_opts:
|
||||||
|
less_opts += " -R"
|
||||||
|
env["LESS"] = less_opts
|
||||||
|
|
||||||
cmd = shlex.split(pager) + [tmpfile.name]
|
cmd = shlex.split(pager) + [tmpfile.name]
|
||||||
try:
|
try:
|
||||||
run_external(*cmd)
|
run_external(*cmd, env=env)
|
||||||
finally:
|
finally:
|
||||||
tmpfile.close()
|
tmpfile.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user