@@ -31,11 +31,8 @@ def main():
31
31
if main and (main .update_after_shutdown or main .restart_after_shutdown ): # Updater
32
32
if main .update_after_shutdown :
33
33
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 ()
39
36
else :
40
37
print ("Restarting..." )
41
38
restart ()
@@ -56,13 +53,26 @@ def restart():
56
53
import time
57
54
time .sleep (1 ) # Wait files to close
58
55
59
- args = [ arg for arg in sys .argv [:] if arg not in ( "--open_browser" , "default_browser" ) ]
56
+ args = sys .argv [:]
60
57
61
58
sys .executable = sys .executable .replace (".pkg" , "" ) # Frozen mac fix
62
59
63
60
if not getattr (sys , 'frozen' , False ):
64
61
args .insert (0 , sys .executable )
65
62
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
+
66
76
if sys .platform == 'win32' :
67
77
args = ['"%s"' % arg for arg in args ]
68
78
0 commit comments