Update action.py : Redirect Docker command output to prevent Python hang

When executing Docker commands via Python, such as `docker kill -s HUP <container>`, 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.
pull/425/head^2
e345 2025-09-22 15:41:50 +08:00 committed by GitHub
parent 6b7cfd1e86
commit b25ce00e12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -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}"