Do not prevent download if locking is unsupported

Closes #3022

Failure to lock download-archive is still fatal.
This is consistent with youtube-dl's behavior
This commit is contained in:
pukkandan
2022-04-05 23:08:18 +05:30
parent ce0593ef61
commit 0edb3e336c
2 changed files with 52 additions and 45 deletions

View File

@@ -11,6 +11,7 @@ from ..utils import (
encodeFilename,
error_to_compat_str,
format_bytes,
LockingUnsupportedError,
sanitize_open,
shell_quote,
timeconvert,
@@ -234,7 +235,10 @@ class FileDownloader(object):
@wrap_file_access('open', fatal=True)
def sanitize_open(self, filename, open_mode):
return sanitize_open(filename, open_mode)
f, filename = sanitize_open(filename, open_mode)
if not getattr(f, 'locked', None):
self.write_debug(f'{LockingUnsupportedError.msg}. Proceeding without locking', only_once=True)
return f, filename
@wrap_file_access('remove')
def try_remove(self, filename):