Mercurial > hg
changeset 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 | 44ea12756fef |
children | 8d1cdee372e6 |
files | mercurial/util.py |
diffstat | 1 files changed, 1 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Fri Aug 05 14:00:39 2016 -0400 +++ b/mercurial/util.py Fri Aug 05 14:00:46 2016 -0400 @@ -1012,10 +1012,7 @@ proc = subprocess.Popen(cmd, shell=True, close_fds=closefds, env=env, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - while True: - line = proc.stdout.readline() - if not line: - break + for line in iter(proc.stdout.readline, ''): out.write(line) proc.wait() rc = proc.returncode