worker: migrate to util.iterfile
authorJun Wu <quark@fb.com>
Mon, 14 Nov 2016 23:12:11 +0000
changeset 30396 78a58dcf8853
parent 30395 10514a92860e
child 30397 564b33acc21f
worker: migrate to util.iterfile
mercurial/worker.py
--- a/mercurial/worker.py	Mon Nov 14 23:32:54 2016 +0000
+++ b/mercurial/worker.py	Mon Nov 14 23:12:11 2016 +0000
@@ -14,7 +14,10 @@
 import threading
 
 from .i18n import _
-from . import error
+from . import (
+    error,
+    util,
+)
 
 def countcpus():
     '''try to count the number of CPUs on the system'''
@@ -128,7 +131,7 @@
                 os.kill(os.getpid(), -status)
             sys.exit(status)
     try:
-        for line in fp:
+        for line in util.iterfile(fp):
             l = line.split(' ', 1)
             yield int(l[0]), l[1][:-1]
     except: # re-raises