jsvn: do not use a pager with "propedit" command

This commit is contained in:
Josh Holtrop 2012-02-20 15:51:38 -05:00
parent a47ff416a1
commit e08d51d0a8

18
jsvn
View File

@ -465,13 +465,15 @@ def main(argv):
realsvn = findInPath('svn') realsvn = findInPath('svn')
colorsvn = findInPath('colorsvn') colorsvn = findInPath('colorsvn')
out = sys.stdout out = sys.stdout
stdout_is_a_tty = sys.stdout.isatty() using_pager = False
if stdout_is_a_tty: if sys.stdout.isatty():
pager = 'less -FRX' if not (len(argv) >= 1 and argv[0] in ('propedit')):
if 'PAGER' in os.environ and os.environ['PAGER'] != '': pager = 'less -FRX'
pager = os.environ['PAGER'] if 'PAGER' in os.environ and os.environ['PAGER'] != '':
pager_proc = Popen(pager, shell=True, stdin=PIPE) pager = os.environ['PAGER']
out = pager_proc.stdin pager_proc = Popen(pager, shell=True, stdin=PIPE)
out = pager_proc.stdin
using_pager = True
if realsvn == '': if realsvn == '':
sys.stderr.write("Error: 'svn' not found in path\n") sys.stderr.write("Error: 'svn' not found in path\n")
@ -506,7 +508,7 @@ def main(argv):
if do_normal_exec: if do_normal_exec:
Popen([realsvn] + argv, stdout=out).wait() Popen([realsvn] + argv, stdout=out).wait()
if stdout_is_a_tty: if using_pager:
out.close() out.close()
pager_proc.wait() pager_proc.wait()
return 0 return 0