From 1890fc6389393ffaa05fa27bd47717f4d862404f Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 3 Jun 2022 21:29:03 +0530 Subject: [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 --- yt_dlp/utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'yt_dlp/utils.py') diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index b0300b724..00721eb46 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -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): -- cgit v1.2.3