| 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 subprocess | 9 import subprocess |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 p = subprocess.Popen(args=args, cwd=cwd, stdout=subprocess.PIPE, | 61 p = subprocess.Popen(args=args, cwd=cwd, stdout=subprocess.PIPE, |
| 62 stderr=subprocess.PIPE, shell=shell) | 62 stderr=subprocess.PIPE, shell=shell) |
| 63 stdout, stderr = p.communicate() | 63 stdout, stderr = p.communicate() |
| 64 exit_code = p.returncode | 64 exit_code = p.returncode |
| 65 if stderr: | 65 if stderr: |
| 66 logging.critical(stderr) | 66 logging.critical(stderr) |
| 67 logging.info(stdout[:4096]) # Truncate output longer than 4k. | 67 logging.info(stdout[:4096]) # Truncate output longer than 4k. |
| 68 return (exit_code, stdout) | 68 return (exit_code, stdout) |
| 69 | 69 |
| 70 class OutDirectory(object): | 70 class OutDirectory(object): |
| 71 _out_directory = constants.CHROME_DIR | 71 _out_directory = os.path.join(constants.CHROME_DIR, 'out') |
| 72 @staticmethod | 72 @staticmethod |
| 73 def set(out_directory): | 73 def set(out_directory): |
| 74 OutDirectory._out_directory = out_directory | 74 OutDirectory._out_directory = out_directory |
| 75 @staticmethod | 75 @staticmethod |
| 76 def get(): | 76 def get(): |
| 77 return OutDirectory._out_directory | 77 return OutDirectory._out_directory |
| OLD | NEW |