mirror of
https://github.com/frappe/bench.git
synced 2024-11-13 16:56:33 +00:00
fix: Allow sudo restart for supervisor (backwards compatibility)
This commit is contained in:
parent
7a4ade9192
commit
fc7c047c28
@ -253,7 +253,13 @@ def restart_supervisor_processes(bench_path=".", web_workers=False):
|
||||
bench.run(cmd)
|
||||
|
||||
else:
|
||||
supervisor_status = get_cmd_output("supervisorctl status", cwd=bench_path)
|
||||
sudo = ""
|
||||
try:
|
||||
supervisor_status = get_cmd_output("supervisorctl status", cwd=bench_path)
|
||||
except Exception as e:
|
||||
if e.returncode == 127:
|
||||
sudo = "sudo "
|
||||
supervisor_status = get_cmd_output("sudo supervisorctl status", cwd=bench_path)
|
||||
|
||||
if web_workers and f"{bench_name}-web:" in supervisor_status:
|
||||
group = f"{bench_name}-web:\t"
|
||||
@ -269,7 +275,7 @@ def restart_supervisor_processes(bench_path=".", web_workers=False):
|
||||
else:
|
||||
group = "frappe:"
|
||||
|
||||
bench.run(f"supervisorctl restart {group}")
|
||||
bench.run(f"{sudo}supervisorctl restart {group}")
|
||||
|
||||
|
||||
def restart_systemd_processes(bench_path=".", web_workers=False):
|
||||
|
Loading…
Reference in New Issue
Block a user