mirror of
https://github.com/trustedsec/hate_crack.git
synced 2026-07-11 22:52:05 -07:00
Check return code and log stderr on cleanup failure
Co-authored-by: bandrel <3598052+bandrel@users.noreply.github.com>
This commit is contained in:
@@ -41,15 +41,21 @@ def docker_image():
|
||||
|
||||
# Cleanup: remove the Docker image after tests complete
|
||||
try:
|
||||
subprocess.run(
|
||||
result = subprocess.run(
|
||||
["docker", "image", "rm", image_tag],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=60,
|
||||
)
|
||||
if result.returncode != 0:
|
||||
print(
|
||||
f"Warning: Failed to remove Docker image {image_tag}. "
|
||||
f"stderr={result.stderr}",
|
||||
file=sys.stderr
|
||||
)
|
||||
except Exception as e:
|
||||
# Don't fail the test if cleanup fails, but log the issue
|
||||
print(f"Warning: Failed to remove Docker image {image_tag}: {e}", file=sys.stderr)
|
||||
print(f"Warning: Exception while removing Docker image {image_tag}: {e}", file=sys.stderr)
|
||||
|
||||
|
||||
def _run_container(image_tag, command, timeout=180):
|
||||
|
||||
Reference in New Issue
Block a user