@@ -31,11 +31,8 @@ def main():
3131 if main and (main .update_after_shutdown or main .restart_after_shutdown ): # Updater
3232 if main .update_after_shutdown :
3333 import update
34- if sys .platform .startswith ("win" ):
35- update .update (restart_win = True )
36- else :
37- update .update ()
38- restart ()
34+ update .update ()
35+ restart ()
3936 else :
4037 print ("Restarting..." )
4138 restart ()
@@ -56,13 +53,26 @@ def restart():
5653 import time
5754 time .sleep (1 ) # Wait files to close
5855
59- args = [ arg for arg in sys .argv [:] if arg not in ( "--open_browser" , "default_browser" ) ]
56+ args = sys .argv [:]
6057
6158 sys .executable = sys .executable .replace (".pkg" , "" ) # Frozen mac fix
6259
6360 if not getattr (sys , 'frozen' , False ):
6461 args .insert (0 , sys .executable )
6562
63+ # Don't open browser after restart
64+ if "--open_browser" in args :
65+ del args [args .index ("--open_browser" ) + 1 ] # argument value
66+ del args [args .index ("--open_browser" )] # argument key
67+
68+ if getattr (sys , 'frozen' , False ):
69+ pos_first_arg = 1 # Only the executable
70+ else :
71+ pos_first_arg = 2 # Interpter, .py file path
72+
73+ args .insert (pos_first_arg , "--open_browser" )
74+ args .insert (pos_first_arg + 1 , "False" )
75+
6676 if sys .platform == 'win32' :
6777 args = ['"%s"' % arg for arg in args ]
6878
0 commit comments