OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """A wrapper for subprocess to make calling shell commands easier.""" | 5 """A wrapper for subprocess to make calling shell commands easier.""" |
6 | 6 |
7 import os | 7 import os |
8 import logging | 8 import logging |
9 import pipes | 9 import pipes |
10 import signal | 10 import signal |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 tmperr.close() | 90 tmperr.close() |
91 if stderr: | 91 if stderr: |
92 logging.critical(stderr) | 92 logging.critical(stderr) |
93 tmpout.seek(0) | 93 tmpout.seek(0) |
94 stdout = tmpout.read() | 94 stdout = tmpout.read() |
95 tmpout.close() | 95 tmpout.close() |
96 if len(stdout) > 4096: | 96 if len(stdout) > 4096: |
97 logging.debug('Truncated output:') | 97 logging.debug('Truncated output:') |
98 logging.debug(stdout[:4096]) | 98 logging.debug(stdout[:4096]) |
99 return (exit_code, stdout) | 99 return (exit_code, stdout) |
100 | |
101 | |
102 class OutDirectory(object): | |
103 _out_directory = os.path.join(constants.DIR_SOURCE_ROOT, | |
104 os.environ.get('CHROMIUM_OUT_DIR','out')) | |
105 @staticmethod | |
106 def set(out_directory): | |
107 OutDirectory._out_directory = out_directory | |
108 @staticmethod | |
109 def get(): | |
110 return OutDirectory._out_directory | |
OLD | NEW |