author | Matt Harbison <matt_harbison@yahoo.com> |
Fri, 20 Sep 2024 00:20:24 -0400 | |
changeset 51925 | f833ad92ee44 |
parent 51924 | 1d95a87813ad |
child 51926 | cbd01bf33802 |
mercurial/util.py | file | annotate | diff | comparison | revisions |
--- a/mercurial/util.py Fri Sep 20 00:04:09 2024 -0400 +++ b/mercurial/util.py Fri Sep 20 00:20:24 2024 -0400 @@ -2201,8 +2201,10 @@ flags = os.O_CREAT | os.O_WRONLY | os.O_EXCL | getattr(os, 'O_BINARY', 0) ld = os.open(pathname, flags) - os.write(ld, info) - os.close(ld) + try: + os.write(ld, info) + finally: + os.close(ld) def readlock(pathname: bytes) -> bytes: