[cleanup] Misc fixes

Cherry-picks from: #3498, #3947
Related: #3949, https://github.com/yt-dlp/yt-dlp/issues/1839#issuecomment-1140313836
Authored by: pukkandan, flashdagger, gamer191
This commit is contained in:
pukkandan
2022-06-03 21:29:03 +05:30
parent c4910024f3
commit 1890fc6389
14 changed files with 119 additions and 98 deletions

View File

@@ -1936,7 +1936,7 @@ def intlist_to_bytes(xs):
class LockingUnsupportedError(OSError):
msg = 'File locking is not supported on this platform'
msg = 'File locking is not supported'
def __init__(self):
super().__init__(self.msg)
@@ -2061,8 +2061,11 @@ class locked_file:
try:
self.f.truncate()
except OSError as e:
if e.errno != 29: # Illegal seek, expected when self.f is a FIFO
raise e
if e.errno not in (
errno.ESPIPE, # Illegal seek - expected for FIFO
errno.EINVAL, # Invalid argument - expected for /dev/null
):
raise
return self
def unlock(self):