@@ -93,26 +93,29 @@ def main() -> None:
9393 keep_going (args .yes or args .init )
9494 run_command (f'poetry run { (Path ("tools" ) / "validate_config_files.py" ).as_posix ()} --update' )
9595
96- print ('* Restarting' )
97- keep_going (args .yes )
98- if platform .system () == 'Windows' :
99- print ('Restarting with poetry...' )
100- run_command ('poetry run stop' , expect_fail = True )
101- run_command ('poetry run start' , capture_output = False )
102- print ('Started.' )
103- else :
104- service = get_config ('generic' , 'systemd_service_name' )
105- p = subprocess .run (["systemctl" , "is-active" , "--quiet" , service ])
106- try :
107- p .check_returncode ()
108- print ('Restarting with systemd...' )
109- run_command (f'sudo service { service } restart' )
110- print ('done.' )
111- except subprocess .CalledProcessError :
96+ if not args .init :
97+ # Init must finish without user interaction.
98+
99+ print ('* Restarting' )
100+ keep_going (args .yes )
101+ if platform .system () == 'Windows' :
112102 print ('Restarting with poetry...' )
113103 run_command ('poetry run stop' , expect_fail = True )
114104 run_command ('poetry run start' , capture_output = False )
115105 print ('Started.' )
106+ else :
107+ service = get_config ('generic' , 'systemd_service_name' )
108+ p = subprocess .run (["systemctl" , "is-active" , "--quiet" , service ])
109+ try :
110+ p .check_returncode ()
111+ print ('Restarting with systemd...' )
112+ run_command (f'sudo service { service } restart' )
113+ print ('done.' )
114+ except subprocess .CalledProcessError :
115+ print ('Restarting with poetry...' )
116+ run_command ('poetry run stop' , expect_fail = True )
117+ run_command ('poetry run start' , capture_output = False )
118+ print ('Started.' )
116119
117120
118121if __name__ == '__main__' :
0 commit comments