Skip to content

A feature-rich command-line audio/video downloader

[utils] `locked_file`: Ignore illegal seek on `truncate` (#3610)

Justin Keogh131e14dc6650
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 0b28b0926f..e25a112d32 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -2011,7 +2011,11 @@ class locked_file:
self.f.close()
raise
if 'w' in self.mode:
- self.f.truncate()
+ try:
+ self.f.truncate()
+ except OSError as e:
+ if e.errno != 29: # Illegal seek, expected when self.f is a FIFO
+ raise e
return self
def unlock(self):