comparison mercurial/util.py @ 29730:4d23cd6e2219

util: use `iter(callable, sentinel)` instead of while True This is functionally equivalent, but is a little more concise.
author Augie Fackler <augie@google.com>
date Fri, 05 Aug 2016 14:00:46 -0400
parents 491ee264b9f6
children 279cd80059d4
comparison
equal deleted inserted replaced
29729:44ea12756fef 29730:4d23cd6e2219
1010 env=env, cwd=cwd) 1010 env=env, cwd=cwd)
1011 else: 1011 else:
1012 proc = subprocess.Popen(cmd, shell=True, close_fds=closefds, 1012 proc = subprocess.Popen(cmd, shell=True, close_fds=closefds,
1013 env=env, cwd=cwd, stdout=subprocess.PIPE, 1013 env=env, cwd=cwd, stdout=subprocess.PIPE,
1014 stderr=subprocess.STDOUT) 1014 stderr=subprocess.STDOUT)
1015 while True: 1015 for line in iter(proc.stdout.readline, ''):
1016 line = proc.stdout.readline()
1017 if not line:
1018 break
1019 out.write(line) 1016 out.write(line)
1020 proc.wait() 1017 proc.wait()
1021 rc = proc.returncode 1018 rc = proc.returncode
1022 if sys.platform == 'OpenVMS' and rc & 1: 1019 if sys.platform == 'OpenVMS' and rc & 1:
1023 rc = 0 1020 rc = 0