1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 22:56:15 +01:00

Handle empty EDITOR=/PAGER= env variable properly

This commit is contained in:
Daniel Mach 2022-12-07 15:57:16 +01:00
parent 84f53aabd9
commit 37bb5e7785

View File

@ -4197,7 +4197,8 @@ def run_pager(message, tmp_suffix=''):
else: else:
tmpfile.write(message) tmpfile.write(message)
tmpfile.flush() tmpfile.flush()
pager = os.getenv('PAGER', default=get_default_pager()) pager = os.getenv("PAGER", default="").strip()
pager = pager or get_default_pager()
cmd = shlex.split(pager) + [tmpfile.name] cmd = shlex.split(pager) + [tmpfile.name]
try: try:
run_external(*cmd) run_external(*cmd)
@ -4212,7 +4213,8 @@ def run_editor(filename):
def _editor_command(): def _editor_command():
editor = os.getenv('EDITOR', default=get_default_editor()) editor = os.getenv("EDITOR", default="").strip()
editor = editor or get_default_editor()
try: try:
cmd = shlex.split(editor) cmd = shlex.split(editor)
except SyntaxError: except SyntaxError: