]> jfr.im git - yt-dlp.git/commitdiff
Return an error code if update fails
authorpukkandan <redacted>
Fri, 20 May 2022 00:25:32 +0000 (05:55 +0530)
committerpukkandan <redacted>
Fri, 20 May 2022 00:31:37 +0000 (06:01 +0530)
Closes #3802

yt_dlp/__init__.py

index b2429f5afce6643fafefbd6f5e569056c2430bcd..893b86a3be0e7daa93f57be3fc514dbee4784881 100644 (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(