From ab5bc721a099df03181fa6dc4ab06bff86a2d9d9 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 9 Oct 2015 14:46:29 -0700 Subject: [PATCH] prevent polluting output by subprocesses --- tools/run_tests/dockerjob.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/run_tests/dockerjob.py b/tools/run_tests/dockerjob.py index 0d4a1fc117e..6427b8e0220 100755 --- a/tools/run_tests/dockerjob.py +++ b/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