mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-07-25 12:23:51 +00:00
[core] Don't let format testing alter the return code (#13767)
Closes #13750 Authored by: bashonly
This commit is contained in:
parent
5f951ce929
commit
4919051e44
@ -2208,6 +2208,9 @@ class YoutubeDL:
|
|||||||
continue
|
continue
|
||||||
temp_file = tempfile.NamedTemporaryFile(suffix='.tmp', delete=False, dir=path or None)
|
temp_file = tempfile.NamedTemporaryFile(suffix='.tmp', delete=False, dir=path or None)
|
||||||
temp_file.close()
|
temp_file.close()
|
||||||
|
# If FragmentFD fails when testing a fragment, it will wrongly set a non-zero return code.
|
||||||
|
# Save the actual return code for later. See https://github.com/yt-dlp/yt-dlp/issues/13750
|
||||||
|
original_retcode = self._download_retcode
|
||||||
try:
|
try:
|
||||||
success, _ = self.dl(temp_file.name, f, test=True)
|
success, _ = self.dl(temp_file.name, f, test=True)
|
||||||
except (DownloadError, OSError, ValueError, *network_exceptions):
|
except (DownloadError, OSError, ValueError, *network_exceptions):
|
||||||
@ -2218,6 +2221,8 @@ class YoutubeDL:
|
|||||||
os.remove(temp_file.name)
|
os.remove(temp_file.name)
|
||||||
except OSError:
|
except OSError:
|
||||||
self.report_warning(f'Unable to delete temporary file "{temp_file.name}"')
|
self.report_warning(f'Unable to delete temporary file "{temp_file.name}"')
|
||||||
|
# Restore the actual return code
|
||||||
|
self._download_retcode = original_retcode
|
||||||
f['__working'] = success
|
f['__working'] = success
|
||||||
if success:
|
if success:
|
||||||
f.pop('__needs_testing', None)
|
f.pop('__needs_testing', None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user