swap to splitlines/run
All checks were successful
Deploy Containers / Prepare (push) Successful in 4s

This commit is contained in:
2026-04-06 13:34:41 -04:00
parent 1e8933ee72
commit 3ff1c2c51f

View File

@@ -73,10 +73,16 @@ def main():
task_name = task task_name = task
print(f"[MAIN] Removal task name: {task_name}") print(f"[MAIN] Removal task name: {task_name}")
containers = subprocess.run(f'docker ps --filter "name={task_name}" -q', shell=True, stdout=subprocess.PIPE) result = subprocess.run(
print(containers.stdout) f'docker ps --filter "name={task_name}" -q',
for line in containers.stdout: shell=True,
capture_output=True
)
for line in result.stdout.splitlines():
container_id = line.strip().decode("utf8") container_id = line.strip().decode("utf8")
if not container_id:
continue
print(f"[MAIN] Found Docker container {container_id} related to {task_name}, removing..") print(f"[MAIN] Found Docker container {container_id} related to {task_name}, removing..")
subprocess.run(f"/usr/bin/docker container stop {container_id}", shell=True) subprocess.run(f"/usr/bin/docker container stop {container_id}", shell=True)
subprocess.run(f"/usr/bin/docker container rm {container_id}", shell=True) subprocess.run(f"/usr/bin/docker container rm {container_id}", shell=True)