Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

Lost arguments when extract_and_execute. #74

Closed
filonenko-mikhail opened this issue Jul 12, 2017 · 5 comments
Closed

Lost arguments when extract_and_execute. #74

filonenko-mikhail opened this issue Jul 12, 2017 · 5 comments

Comments

@filonenko-mikhail
Copy link

I use command line arguments for different application modes.
Also my app has check for updates task. I use extract_and_execute, and app lost its mode, because of empty command line.
Could you please copy sys.argv[1:] to command line of updated app instance?

@JMSwag
Copy link
Member

JMSwag commented Jul 26, 2017

@filonenko-mikhail Is it an auto-update sort of thing?

@filonenko-mikhail
Copy link
Author

I can't say in general about it, but if you provide extract_and_execute api, it is more usable when programmer can setup execution of updated binary.

@JMSwag
Copy link
Member

JMSwag commented Oct 4, 2017

@filonenko-mikhail Do you have any suggestions on how you would implement this?

@filonenko-mikhail
Copy link
Author

diff --git a/pyupdater/client/updates.py b/pyupdater/client/updates.py
index d729a97..863f009 100644
--- a/pyupdater/client/updates.py
+++ b/pyupdater/client/updates.py
@@ -163,7 +163,7 @@ class Restarter(object):
             self._restart()

     def _restart(self):
-        os.execl(self.current_app, self.name)
+        os.execl(self.current_app, self.name, *sys.argv[1:])

     def _win_overwrite(self):
         with io.open(self.bat_file, 'w', encoding='utf-8') as bat:

@eullerborges
Copy link

@JMSwag I also have this problem. My app needs parameters on initialization and those parameters are lost on restart/overwrite. @filonenko-mikhail have you found any other solution? Or do you keep an updated version of the library? Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants