1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-14 01:26:23 +01:00

- "run_pager()": cleanup + fixed isatty() call

This commit is contained in:
Marcus Huewe 2010-05-09 21:47:21 +02:00
parent 4273114ac1
commit e010e46b2b

View File

@ -2481,24 +2481,17 @@ def read_meta_from_spec(specfile, *args):
return spec_data
def run_pager(message):
import tempfile, sys
if not sys.stdout.isatty:
print message
else:
tmpfile = None
if tmpfile is None:
tmpfile = tempfile.NamedTemporaryFile()
tmpfile.write(message)
tmpfile.flush()
pager = os.getenv('PAGER', default='less')
subprocess.call('%s %s' % (pager, tmpfile.name), shell=True)
if tmpfile is not None:
tmpfile.close()
import tempfile, sys
if not sys.stdout.isatty():
print message
else:
tmpfile = tempfile.NamedTemporaryFile()
tmpfile.write(message)
tmpfile.flush()
pager = os.getenv('PAGER', default='less')
subprocess.call('%s %s' % (pager, tmpfile.name), shell=True)
tmpfile.close()
def run_editor(filename):
if sys.platform[:3] != 'win':