OLD | NEW |
---|---|
1 # Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Helper functions for gcc_toolchain.gni wrappers.""" | 5 """Helper functions for gcc_toolchain.gni wrappers.""" |
6 | 6 |
7 import os | 7 import os |
8 import re | 8 import re |
9 import subprocess | 9 import subprocess |
10 import shlex | 10 import shlex |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 lines = text.splitlines() | 85 lines = text.splitlines() |
86 for ln in lines: | 86 for ln in lines: |
87 match = _WHITELIST_RE.search(ln) | 87 match = _WHITELIST_RE.search(ln) |
88 if match: | 88 if match: |
89 resource_id = int(match.group('resource_id')) | 89 resource_id = int(match.group('resource_id')) |
90 used_resources.add(resource_id) | 90 used_resources.add(resource_id) |
91 | 91 |
92 return used_resources | 92 return used_resources |
93 | 93 |
94 | 94 |
95 | |
Wez
2017/02/03 19:27:55
nit: Spurious extra line!
Kevin M
2017/02/06 17:39:56
Done.
| |
95 def CaptureCommandStderr(command, env=None): | 96 def CaptureCommandStderr(command, env=None): |
96 """Returns the stderr of a command. | 97 """Returns the stderr of a command. |
97 | 98 |
98 Args: | 99 Args: |
99 command: A list containing the command and arguments. | 100 command: A list containing the command and arguments. |
100 env: Environment variables for the new process. | 101 env: Environment variables for the new process. |
101 """ | 102 """ |
102 child = subprocess.Popen(command, stderr=subprocess.PIPE, env=env) | 103 child = subprocess.Popen(command, stderr=subprocess.PIPE, env=env) |
103 _, stderr = child.communicate() | 104 _, stderr = child.communicate() |
104 return child.returncode, stderr | 105 return child.returncode, stderr |
OLD | NEW |