Skip to content

Commit ee91bf1

Browse files
committed
Use bpython.pager.get_pager_command
And use shlex to split PAGER Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
1 parent d4db7ed commit ee91bf1

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from bpython import translations; translations.init()
3535
from bpython.translations import _
3636
from bpython._py3compat import py3
37+
from bpython.pager import get_pager_command
3738

3839
from bpython.curtsiesfrontend import replpainter as paint
3940
from bpython.curtsiesfrontend import sitefix; sitefix.monkeypatch_quit()
@@ -1350,7 +1351,7 @@ def focus_on_subprocess(self, args):
13501351
signal.signal(signal.SIGWINCH, prev_sigwinch_handler)
13511352

13521353
def pager(self, text):
1353-
command = os.environ.get('PAGER', 'less -rf').split()
1354+
command = get_pager_command()
13541355
with tempfile.NamedTemporaryFile() as tmp:
13551356
tmp.write(text)
13561357
tmp.flush()

bpython/pager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
import pydoc
2828
import subprocess
2929
import sys
30+
import shlex
3031

31-
32-
def get_pager_command():
33-
command = os.environ.get('PAGER', 'less -r').split()
32+
def get_pager_command(default='less -r'):
33+
command = shlex.split(os.environ.get('PAGER', default))
3434
return command
3535

3636

0 commit comments

Comments
 (0)