[update] Fix endless update loop for `linux_exe` builds (#11827)

Closes #11808
Authored by: bashonly
This commit is contained in:
bashonly 2024-12-15 19:47:50 +00:00 committed by GitHub
parent 2037a6414f
commit 3d3ee458c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 2 deletions

View File

@ -525,11 +525,16 @@ class Updater:
@functools.cached_property @functools.cached_property
def cmd(self): def cmd(self):
"""The command-line to run the executable, if known""" """The command-line to run the executable, if known"""
argv = None
# There is no sys.orig_argv in py < 3.10. Also, it can be [] when frozen # There is no sys.orig_argv in py < 3.10. Also, it can be [] when frozen
if getattr(sys, 'orig_argv', None): if getattr(sys, 'orig_argv', None):
return sys.orig_argv argv = sys.orig_argv
elif getattr(sys, 'frozen', False): elif getattr(sys, 'frozen', False):
return sys.argv argv = sys.argv
# linux_static exe's argv[0] will be /tmp/staticx-NNNN/yt-dlp_linux if we don't fixup here
if argv and os.getenv('STATICX_PROG_PATH'):
argv = [self.filename, *argv[1:]]
return argv
def restart(self): def restart(self):
"""Restart the executable""" """Restart the executable"""