Skip to content

Commit 3cf1bde

Browse files
committed
fix: Make sure update --init doesn't need interactions
1 parent b46c818 commit 3cf1bde

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

bin/update.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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

118121
if __name__ == '__main__':

0 commit comments

Comments
 (0)