зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1511285 - Make 'mach clang-format' more efficient when outputting to stdout. r=ehsan, a=aryx
Differential Revision: https://phabricator.services.mozilla.com/D13508 --HG-- extra : rebase_source : e4c31242d0bc309b80dfc36e08ed3ec55d277126 extra : amend_source : 8070ca927657f4078e557e06e4435600f5ce4a33
This commit is contained in:
Родитель
6b07492159
Коммит
4e2f400fdf
|
@ -2816,22 +2816,17 @@ class StaticAnalysis(MachCommandBase):
|
|||
path_list = self._generate_path_list(assume_filename, False)
|
||||
|
||||
if path_list == []:
|
||||
# This means we are dealing with a third party so just return it's content
|
||||
with open(paths[0], 'r') as fin:
|
||||
sys.stdout.write(fin.read().decode('utf8'))
|
||||
return 0
|
||||
return 0
|
||||
|
||||
# We use -assume-filename in order to better determine the path for
|
||||
# the .clang-format when it is ran outside of the repo, for example
|
||||
# by the extension hg-formatsource
|
||||
args = [clang_format, "-assume-filename={}".format(assume_filename[0])]
|
||||
|
||||
process = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
process = subprocess.Popen(args, stdin=subprocess.PIPE)
|
||||
with open(paths[0], 'r') as fin:
|
||||
process.stdin.write(fin.read())
|
||||
output = process.communicate()[0]
|
||||
process.stdin.close()
|
||||
sys.stdout.write(output.decode('utf8'))
|
||||
return 0
|
||||
|
||||
def _run_clang_format_path(self, clang_format, show, paths):
|
||||
|
|
Загрузка…
Ссылка в новой задаче