# HG changeset patch # User Augie Fackler # Date 2016-08-05 18:00:46 # Node ID 4d23cd6e2219493be62dfb91f69c3c8104252b17 # Parent 44ea12756fef874dd07c7dbbeca64ed10789dd48 util: use `iter(callable, sentinel)` instead of while True This is functionally equivalent, but is a little more concise. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1012,10 +1012,7 @@ def system(cmd, environ=None, cwd=None, 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