From 5d6b00fac64a829cca5637bb76abe618291b8b60 Mon Sep 17 00:00:00 2001 From: Robert Iannucci Date: Fri, 12 Jan 2018 15:43:21 -0800 Subject: [PATCH] [cit] Use subprocess2 to properly sink stdout. This should fix the "halts mid-way" symptoms observed on linux. R=agable@chromium.org, hinoka@chromium.org Bug: 782543 Change-Id: Ia5254b7f8e73b5646f2782e36acc52b4772b095e Reviewed-on: https://chromium-review.googlesource.com/865821 Reviewed-by: Ryan Tseng Reviewed-by: Robbie Iannucci Commit-Queue: Robbie Iannucci --- cit.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cit.py b/cit.py index 46c5ccef2..177b7ed07 100755 --- a/cit.py +++ b/cit.py @@ -12,14 +12,15 @@ This tool does a two things: * Acts as an alias to infra.git/cipd/ """ -# TODO(hinoka): Use cipd/glyco instead of git/gclient. +# TODO(hinoka,iannucci): Pre-pack infra tools in cipd package with vpython spec. import argparse import sys import os -import subprocess import re +import subprocess2 as subprocess + SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) GCLIENT = os.path.join(SCRIPT_DIR, 'gclient.py') @@ -37,7 +38,7 @@ def need_to_update(branch): try: cmd = [sys.executable, GCLIENT, 'revinfo'] subprocess.check_call( - cmd, cwd=os.path.join(TARGET_DIR), stdout=subprocess.PIPE) + cmd, cwd=os.path.join(TARGET_DIR), stdout=subprocess.VOID) except subprocess.CalledProcessError: return True # Gclient failed, definitely need to update. except OSError: @@ -50,7 +51,7 @@ def need_to_update(branch): subprocess.check_call( ['git', 'fetch', 'origin'], cwd=INFRA_DIR, - stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + stdout=subprocess.VOID, stderr=subprocess.STDOUT) origin_rev = get_git_rev(INFRA_DIR, 'origin/%s' % (branch,)) return origin_rev != local_rev @@ -67,11 +68,11 @@ def ensure_infra(branch): subprocess.check_call( [sys.executable, os.path.join(SCRIPT_DIR, 'fetch.py'), 'infra'], cwd=TARGET_DIR, - stdout=subprocess.PIPE) + stdout=subprocess.VOID) subprocess.check_call( [sys.executable, GCLIENT, 'sync', '--revision', 'origin/%s' % (branch,)], cwd=TARGET_DIR, - stdout=subprocess.PIPE) + stdout=subprocess.VOID) sys.stderr.write(' done.\n') sys.stderr.flush()