xref: /llvm-project-15.0.7/lldb/packages/Python/lldbsuite/support/seven.py (revision 052d95a6)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import six
2
3if six.PY2:
4    import commands
5    get_command_output = commands.getoutput
6    get_command_status_output = commands.getstatusoutput
7
8    cmp_ = cmp
9else:
10    def get_command_status_output(command):
11        try:
12            import subprocess
13            return (
14                0,
15                subprocess.check_output(
16                    command,
17                    shell=True,
18                    universal_newlines=True))
19        except subprocess.CalledProcessError as e:
20            return (e.returncode, e.output)
21
22    def get_command_output(command):
23        return get_command_status_output(command)[1]
24
25    cmp_ = lambda x, y: (x > y) - (x < y)
26

served by {OpenGrok

Last Index Update: Tue Oct 21 18:42:31 GMT 2025