forked from qt-creator/qt-creator
Squish: Do not use shell in getOutputFromCmdline
Change-Id: I731b119169063912cd3b528a1a6a58727002ae67 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user