aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-05-20 05:55:32 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-05-20 06:01:37 +0530
commite79969b2425e0c52813780f2b2afbccd4b4b0647 (patch)
tree34e2487d8167d850fca1d98346628e45b7e0bb6a
parent53973b4d2cb349d39d6f240911142b330d1dd80d (diff)
downloadhypervideo-pre-e79969b2425e0c52813780f2b2afbccd4b4b0647.tar.lz
hypervideo-pre-e79969b2425e0c52813780f2b2afbccd4b4b0647.tar.xz
hypervideo-pre-e79969b2425e0c52813780f2b2afbccd4b4b0647.zip
Return an error code if update fails
Closes #3802
-rw-r--r--yt_dlp/__init__.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.py
index b2429f5af..893b86a3b 100644
--- a/yt_dlp/__init__.py
+++ b/yt_dlp/__init__.py
@@ -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(