Squish: Do not use shell in getOutputFromCmdline

Change-Id: I731b119169063912cd3b528a1a6a58727002ae67
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Robert Loehning
2016-05-26 18:51:15 +02:00
parent b4e11b191b
commit c1e7cf84e4
7 changed files with 20 additions and 18 deletions
+3 -3
View File
@@ -139,7 +139,7 @@ def which(program):
command = "where"
else:
command = "which"
foundPath = getOutputFromCmdline(command + " " + program)
foundPath = getOutputFromCmdline([command, program])
if foundPath:
return foundPath.splitlines()[0]
else:
@@ -216,9 +216,9 @@ def logApplicationOutput():
return None
# get the output from a given cmdline call
def getOutputFromCmdline(cmdline):
def getOutputFromCmdline(cmdline, environment=None):
try:
return subprocess.check_output(cmdline, shell=True) # TODO: do not use shell=True
return subprocess.check_output(cmdline, env=environment)
except subprocess.CalledProcessError as e:
test.warning("Command '%s' returned %d" % (e.cmd, e.returncode))
return e.output