changeset 51884 | f833ad92ee44 |
parent 51883 | 1d95a87813ad |
child 51885 | cbd01bf33802 |
--- 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: