A feature-rich command-line audio/video downloader
[utils] `locked_file`: Fix for virtiofs (#6840)
Eveldee45998b3e371b
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.pyindex 2f5e667204..47aa75c470 100644--- a/yt_dlp/utils.py+++ b/yt_dlp/utils.py@@ -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 unlockingexcept ImportError: