OLD | NEW |
1 # coding=utf8 | 1 # coding=utf8 |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 """Collection of subprocess wrapper functions. | 5 """Collection of subprocess wrapper functions. |
6 | 6 |
7 In theory you shouldn't need anything else in subprocess, or this module failed. | 7 In theory you shouldn't need anything else in subprocess, or this module failed. |
8 """ | 8 """ |
9 | 9 |
| 10 from __future__ import with_statement |
10 import logging | 11 import logging |
11 import os | 12 import os |
12 import subprocess | 13 import subprocess |
13 import sys | 14 import sys |
14 import tempfile | 15 import tempfile |
15 import time | 16 import time |
16 import threading | 17 import threading |
17 | 18 |
18 # Constants forwarded from subprocess. | 19 # Constants forwarded from subprocess. |
19 PIPE = subprocess.PIPE | 20 PIPE = subprocess.PIPE |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 194 |
194 Discards communicate()[1]. By default sets stderr=STDOUT. | 195 Discards communicate()[1]. By default sets stderr=STDOUT. |
195 | 196 |
196 Throws if return code is not 0. | 197 Throws if return code is not 0. |
197 | 198 |
198 Works even prior to python 2.7. | 199 Works even prior to python 2.7. |
199 """ | 200 """ |
200 if kwargs.get('stderr') is None: | 201 if kwargs.get('stderr') is None: |
201 kwargs['stderr'] = STDOUT | 202 kwargs['stderr'] = STDOUT |
202 return check_call(args, stdout=PIPE, **kwargs)[0] | 203 return check_call(args, stdout=PIPE, **kwargs)[0] |
OLD | NEW |