Squish: Use more stable subprocess code

Change-Id: I9a895831f9d57562a9eeb8491cc7f46c1da2eba1
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
Christian Stenger
2016-05-24 12:39:30 +02:00
parent a00a73a74d
commit e564abdd9a
+5 -4
View File
@@ -217,10 +217,11 @@ def logApplicationOutput():
# get the output from a given cmdline call
def getOutputFromCmdline(cmdline):
versCall = subprocess.Popen(cmdline, stdout=subprocess.PIPE, shell=True)
result = versCall.communicate()[0]
versCall.stdout.close()
return result
try:
return subprocess.check_output(cmdline, shell=True) # TODO: do not use shell=True
except subprocess.CalledProcessError as e:
test.warning("Command '%s' returned %d" % (e.cmd, e.returncode))
return e.output
def selectFromFileDialog(fileName, waitForFile=False):
if platform.system() == "Darwin":