Conditions | 3 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3.4746 |
Changes | 0 |
1 | # -*- coding: utf-8 -*- |
||
18 | 1 | def output_command(args, cwd=None): |
|
19 | """ |
||
20 | run a shell command and return its output |
||
21 | """ |
||
22 | 1 | try: |
|
23 | 1 | output = subprocess.check_output( |
|
24 | args, |
||
25 | cwd=cwd, |
||
26 | universal_newlines=True, |
||
27 | stderr=subprocess.STDOUT) |
||
28 | except subprocess.CalledProcessError: |
||
29 | output = '' |
||
30 | |||
31 | 1 | if PY3: |
|
32 | return output |
||
33 | else: |
||
34 | 1 | return output.decode('utf-8') |
|
35 | |||
42 |