Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 547e6f0 commit 6dfc870Copy full SHA for 6dfc870
git/util.py
@@ -564,20 +564,14 @@ def _obtain_lock_or_raise(self):
564
565
lock_file = self._lock_file_path()
566
567
- # Create lock file
+ # Create file and lock
568
try:
569
- open(lock_file, 'a').close()
570
- except OSError as e:
571
- # Silence error only if file exists
572
- if e.errno != 17: # 17 -> File exists
573
- raise
574
-
575
- try:
576
- fd = os.open(lock_file, os.O_WRONLY, 0)
577
- flock(fd, LOCK_EX | LOCK_NB)
+ fd = os.open(lock_file, os.O_CREAT, 0)
578
except OSError as e:
579
raise IOError(str(e))
580
+ flock(fd, LOCK_EX | LOCK_NB)
+
581
self._file_descriptor = fd
582
self._owns_lock = True
583
0 commit comments