Skip to content

Commit

Permalink
Merge pull request #1639 from skshetry/close-lockfile
Browse files Browse the repository at this point in the history
util: close lockfile after opening successfully
  • Loading branch information
Byron authored Sep 2, 2023
2 parents f882cd8 + 3e829eb commit 4714740
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion git/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,8 @@ def _obtain_lock_or_raise(self) -> None:
)

try:
open(lock_file, mode='w', closefd=True)
with open(lock_file, mode='w'):
pass
except OSError as e:
raise IOError(str(e)) from e

Expand Down

0 comments on commit 4714740

Please sign in to comment.