Tweak something or other for sake of python 3

This commit is contained in:
Lance Edgar 2018-03-01 23:19:19 -06:00
parent 7dcc8f8efb
commit 85d51948dc

View file

@ -18,7 +18,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA.
# ------------------------------------------------------------------------------
import os, os.path, re, time, sys, traceback, unicodedata, shutil, mimetypes
import os, os.path, re, time, sys, traceback, unicodedata, shutil, mimetypes, subprocess
sequenceTypes = (list, tuple)
# ------------------------------------------------------------------------------
@ -246,7 +246,12 @@ def getTempFileName(prefix='', extension=''):
# ------------------------------------------------------------------------------
def executeCommand(cmd):
'''Executes command p_cmd and returns the content of its stderr'''
childStdIn, childStdOut, childStdErr = os.popen3(cmd)
p = subprocess.Popen(cmd, shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True)
childStdIn, childStdOut, childStdErr = (p.stdin, p.stdout, p.stderr)
res = childStdErr.read()
childStdIn.close(); childStdOut.close(); childStdErr.close()
return res