Merge "Set up locale for bash syntax testing"

This commit is contained in:
Jenkins 2016-01-05 18:07:34 +00:00 committed by Gerrit Code Review
commit 23507e3721
1 changed files with 4 additions and 1 deletions

View File

@ -16,6 +16,7 @@ from __future__ import absolute_import
import argparse import argparse
import fileinput import fileinput
import os
import re import re
import subprocess import subprocess
import sys import sys
@ -116,9 +117,11 @@ def check_syntax(filename, report):
# get bash to check the syntax, parse the output for line numbers # get bash to check the syntax, parse the output for line numbers
# and syntax errors to send to the report. # and syntax errors to send to the report.
syntax_pattern = re.compile('^.*?: line ([0-9]+): (.*)$') syntax_pattern = re.compile('^.*?: line ([0-9]+): (.*)$')
bash_environment = os.environ
bash_environment['LC_ALL'] = 'C'
proc = subprocess.Popen( proc = subprocess.Popen(
['bash', '-n', filename], stdout=subprocess.PIPE, ['bash', '-n', filename], stdout=subprocess.PIPE,
stderr=subprocess.PIPE) stderr=subprocess.PIPE, env=bash_environment)
outputs = proc.communicate() outputs = proc.communicate()
if proc.returncode != 0: if proc.returncode != 0:
syntax_errors = [ syntax_errors = [