prevent polluting output by subprocesses

pull/3761/head
Jan Tattermusch 9 years ago
parent 1f1c5c541a
commit ab5bc721a0
  1. 6
      tools/run_tests/dockerjob.py

@ -55,7 +55,7 @@ def docker_mapped_port(cid, port, timeout_seconds=15):
while time.time() - started < timeout_seconds:
try:
output = subprocess.check_output('docker port %s %s' % (cid, port),
stderr=_DEVNULL
stderr=_DEVNULL,
shell=True)
return int(output.split(':', 2)[1])
except subprocess.CalledProcessError as e:
@ -85,7 +85,9 @@ def remove_image(image, skip_nonexistent=False, max_retries=10):
if skip_nonexistent and not image_exists(image):
return True
for attempt in range(0, max_retries):
if subprocess.call(['docker','rmi', '-f', image]) == 0:
if subprocess.call(['docker','rmi', '-f', image],
stdout=_DEVNULL,
stderr=subprocess.STDOUT) == 0:
return True
time.sleep(2)
print 'Failed to remove docker image %s' % image

Loading…
Cancel
Save