summaryrefslogtreecommitdiff
path: root/usr/src/tools/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/tools/scripts')
-rw-r--r--usr/src/tools/scripts/wsdiff.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/usr/src/tools/scripts/wsdiff.py b/usr/src/tools/scripts/wsdiff.py
index aaab371708..225ea21ce5 100644
--- a/usr/src/tools/scripts/wsdiff.py
+++ b/usr/src/tools/scripts/wsdiff.py
@@ -119,11 +119,21 @@ wsdiff_exceptions = [
"usr/perl5/5.6.1/lib/i86pc-solaris-64int/CORE/libperl.so.1"
]
-def getoutput(cmd):
- if PY3:
- return subprocess.getstatusoutput(cmd)
- else:
- return commands.getstatusoutput(cmd)
+if PY3:
+ def getoutput(cmd):
+ import shlex, tempfile
+ f, fpath = tempfile.mkstemp()
+ status = os.system("{ " + cmd + "; } >" +
+ shlex.quote(fpath) + " 2>&1")
+ returncode = os.WEXITSTATUS(status)
+ with os.fdopen(f, "r") as tfile:
+ output = tfile.read()
+ os.unlink(fpath)
+ if output[-1:] == '\n':
+ output = output[:-1]
+ return returncode, output
+else:
+ getoutput = commands.getstatusoutput
#####
# Logging routines