Conditions | 2 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
1 | #!/usr/bin/env python |
||
9 | def main(args): |
||
10 | command_list = shlex.split('apt-cache policy ' + ' '.join(args[1:])) |
||
11 | process = subprocess.Popen(command_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
||
12 | command_stdout, command_stderr = process.communicate() |
||
13 | command_exitcode = process.returncode |
||
14 | try: |
||
15 | payload = transformer.to_json(command_stdout, command_stderr, command_exitcode) |
||
16 | except Exception as e: |
||
17 | sys.stderr.write('JSON conversion failed. %s' % str(e)) |
||
18 | sys.exit(1) |
||
19 | |||
20 | sys.stdout.write(payload) |
||
21 | |||
24 |