Have observatory_tool always invoke pub with no HTTP_PROXY environment variable set

Fixes #28865

R=zra@google.com

Review-Url: https://codereview.chromium.org/2724483003 .
This commit is contained in:
John McCutchan 2017-02-28 07:59:55 -08:00
parent 7af47d5ea9
commit 6c0a2af761

View file

@ -43,7 +43,17 @@ usage = """observatory_tool.py [options]"""
# True, and return the return code.
def RunCommand(command, always_silent=False):
try:
subprocess.check_output(command, stderr=subprocess.STDOUT)
# Dart IO respects the following environment variables to configure the
# HttpClient proxy: https://api.dartlang.org/stable/1.22.1/dart-io/HttpClient/findProxyFromEnvironment.html
# We strip these to avoid problems with pub build and transformers.
no_http_proxy_env = os.environ.copy()
no_http_proxy_env.pop('http_proxy', None)
no_http_proxy_env.pop('HTTP_PROXY', None)
no_http_proxy_env.pop('https_proxy', None)
no_http_proxy_env.pop('HTTPS_PROXY', None)
subprocess.check_output(command,
stderr=subprocess.STDOUT,
env=no_http_proxy_env)
return 0
except subprocess.CalledProcessError as e:
if not always_silent: