Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 27768:5ef99738a562
util: replace file I/O with readfile
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Tue, 12 Jan 2016 16:16:19 -0800 |
parents | 198f78a52a2f |
children | 4d10600c3f08 |
comparison
equal
deleted
inserted
replaced
27767:ddfb8887212d | 27768:5ef99738a562 |
---|---|
754 if sys.platform == 'OpenVMS' and code & 1: | 754 if sys.platform == 'OpenVMS' and code & 1: |
755 code = 0 | 755 code = 0 |
756 if code: | 756 if code: |
757 raise Abort(_("command '%s' failed: %s") % | 757 raise Abort(_("command '%s' failed: %s") % |
758 (cmd, explainexit(code))) | 758 (cmd, explainexit(code))) |
759 fp = open(outname, 'rb') | 759 return readfile(outname) |
760 r = fp.read() | |
761 fp.close() | |
762 return r | |
763 finally: | 760 finally: |
764 try: | 761 try: |
765 if inname: | 762 if inname: |
766 os.unlink(inname) | 763 os.unlink(inname) |
767 except OSError: | 764 except OSError: |