From 1a12dd70c00a44e34384b1904d18d309ae3c3ac6 Mon Sep 17 00:00:00 2001 From: Serge Guelton Date: Tue, 26 Mar 2019 14:46:15 +0000 Subject: python 2/3 compat: commands vs subprocess Differential Revision: https://reviews.llvm.org/D59584 llvm-svn: 356995 --- lldb/examples/python/process_events.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lldb/examples/python/process_events.py') diff --git a/lldb/examples/python/process_events.py b/lldb/examples/python/process_events.py index a00217b70c8..9fd1347176d 100755 --- a/lldb/examples/python/process_events.py +++ b/lldb/examples/python/process_events.py @@ -8,7 +8,6 @@ # export PYTHONPATH=/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python #---------------------------------------------------------------------- -import commands from __future__ import print_function import optparse @@ -16,6 +15,11 @@ import os import platform import sys +if sys.version_info.major == 2: + import commands as subprocess +else: + import subprocess + #---------------------------------------------------------------------- # Code that auto imports LLDB #---------------------------------------------------------------------- @@ -28,7 +32,7 @@ except ImportError: platform_system = platform.system() if platform_system == 'Darwin': # On Darwin, try the currently selected Xcode directory - xcode_dir = commands.getoutput("xcode-select --print-path") + xcode_dir = subprocess.getoutput("xcode-select --print-path") if xcode_dir: lldb_python_dirs.append( os.path.realpath( -- cgit v1.2.3