From 2241db8a1f6c05325c8a0c9eb5426d96cd6fa984 Mon Sep 17 00:00:00 2001 From: Bruce Dawson Date: Thu, 14 Jan 2021 23:09:11 +0000 Subject: [PATCH] Avoid capture_output to support Python 3.6 autoninja.py uses subprocess.run which requires Python 3 and used capture_output which requires Python 3.6. One user reported this as an issue and it turns out that it is easy to avoid by using subprocess.NULL which then means that Python versions back to 3.3 are supported. Bug: 868590, b/174673874 Change-Id: Ife5e186d9c54747d35ff989dc2afadba5b9a57f5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2630525 Auto-Submit: Bruce Dawson Reviewed-by: Justin Cohen Commit-Queue: Bruce Dawson --- autoninja.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoninja.py b/autoninja.py index f10b15287..e93cc17b2 100755 --- a/autoninja.py +++ b/autoninja.py @@ -112,7 +112,9 @@ if offline or goma_disabled_env in ['true', 't', 'yes', 'y', '1']: if use_remote_build and remote_build_is_goma: # Check to make sure that goma is running. If not, don't start the build. gomacc_path = os.path.join(sys.path[0], '.cipd_bin', 'gomacc') - status = subprocess.run([gomacc_path, 'port'], capture_output=True).returncode + status = subprocess.run([gomacc_path, 'port'], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL).returncode if status == 1: print('echo Goma is not running. Use "goma_ctl start" to start it.') sys.exit(0) @@ -178,4 +180,3 @@ if offline and not sys.platform.startswith('win'): print('RBE_remote_disabled=1 GOMA_DISABLED=1 ' + ' '.join(args)) else: print(' '.join(args)) -