1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-17 00:22:34 +01:00

Return an error code if update fails

Closes #3802
This commit is contained in:
pukkandan 2022-05-20 05:55:32 +05:30
parent 53973b4d2c
commit e79969b242
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39

View File

@ -849,22 +849,16 @@ def _real_main(argv=None):
with YoutubeDL(ydl_opts) as ydl:
actual_use = all_urls or opts.load_info_filename
# Remove cache dir
if opts.rm_cachedir:
ydl.cache.remove()
# Update version
if opts.update_self:
if opts.update_self and run_update(ydl) and actual_use:
# If updater returns True, exit. Required for windows
if run_update(ydl):
if actual_use:
return 100, 'ERROR: The program must exit for the update to complete'
return
return 100, 'ERROR: The program must exit for the update to complete'
# Maybe do nothing
if not actual_use:
if opts.update_self or opts.rm_cachedir:
return
return ydl._download_retcode
ydl.warn_if_short_id(sys.argv[1:] if argv is None else argv)
parser.error(