From b25ce00e128815ee31feaeac78b83a511115bf3d Mon Sep 17 00:00:00 2001 From: e345 Date: Mon, 22 Sep 2025 15:41:50 +0800 Subject: [PATCH] Update action.py : Redirect Docker command output to prevent Python hang When executing Docker commands via Python, such as `docker kill -s HUP `, the process may hang because the command produces output that blocks the Python subprocess. This change appends `> /dev/null` to Docker commands to discard any standard output, ensuring that Python can execute the command without waiting indefinitely. Systemd commands remain unchanged, as they do not exhibit the same blocking behavior. --- app/modules/service/action.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/modules/service/action.py b/app/modules/service/action.py index 31e40b4e..af85ef71 100644 --- a/app/modules/service/action.py +++ b/app/modules/service/action.py @@ -57,7 +57,7 @@ def get_action_command(service: str, action: str, server_id: int) -> str: container_name = sql.get_setting(f'{service}_container_name') if action == 'reload': action = 'kill -s HUP' - commands = f"sudo docker {action} {container_name}" + commands = f"sudo docker {action} {container_name} > /dev/null" else: service_name = service_common.get_correct_service_name(service, server_id) commands = f"sudo systemctl {action} {service_name}"