mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-09-29 10:14:53 +00:00
[utils] locked_file
: Fix for virtiofs (#6840)
Authored by: brandon-dacrib Closes #6823
This commit is contained in:
@@ -2187,10 +2187,11 @@ else:
|
||||
fcntl.lockf(f, flags)
|
||||
|
||||
def _unlock_file(f):
|
||||
try:
|
||||
fcntl.flock(f, fcntl.LOCK_UN)
|
||||
except OSError:
|
||||
fcntl.lockf(f, fcntl.LOCK_UN)
|
||||
with contextlib.suppress(OSError):
|
||||
return fcntl.flock(f, fcntl.LOCK_UN)
|
||||
with contextlib.suppress(OSError):
|
||||
return fcntl.lockf(f, fcntl.LOCK_UN) # AOSP does not have flock()
|
||||
return fcntl.flock(f, fcntl.LOCK_UN | fcntl.LOCK_NB) # virtiofs needs LOCK_NB on unlocking
|
||||
|
||||
except ImportError:
|
||||
|
||||
|
Reference in New Issue
Block a user