Commit 4117ba73 authored by Robert Loehning's avatar Robert Loehning

Squish: Replace remaining shell usages

Change-Id: Id7c2c1a17fed053f2e8601fc4c7716705e260431
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 7d51d384
......@@ -316,7 +316,8 @@ def __configureFW__(workingDir, projectName, isReleaseBuild, addToFW=True):
# Needs admin privileges on Windows 7
# Using the deprecated "netsh firewall" because the newer
# "netsh advfirewall" would need admin privileges on Windows Vista, too.
return subprocess.call('netsh firewall %s allowedprogram "%s.exe" %s %s' % (mode, path, projectName, enable))
return subprocess.call(["netsh", "firewall", mode, "allowedprogram",
"%s.exe" % path, projectName, enable])
# helper to check whether win firewall is running or not
# this doesn't check for other firewalls!
......@@ -333,11 +334,6 @@ def __isWinFirewallRunning__():
return __isWinFirewallRunning__.fireWallState
return None
def __fixQuotes__(string):
if platform.system() in ('Windows', 'Microsoft'):
string = '"' + string + '"'
return string
# this function adds the given executable as an attachable AUT
# Bad: executable/port could be empty strings - you should be aware of this
def addExecutableAsAttachableAUT(executable, port, host=None):
......@@ -348,8 +344,8 @@ def addExecutableAsAttachableAUT(executable, port, host=None):
squishSrv = __getSquishServer__()
if (squishSrv == None):
return False
result = subprocess.call(__fixQuotes__('"%s" --config addAttachableAUT "%s" %s:%s')
% (squishSrv, executable, host, port), shell=True)
result = subprocess.call([squishSrv, "--config", "addAttachableAUT",
executable, "%s:%s" % (host, port)])
if result == 0:
test.passes("Added %s as attachable AUT" % executable)
else:
......@@ -366,8 +362,8 @@ def removeExecutableAsAttachableAUT(executable, port, host=None):
squishSrv = __getSquishServer__()
if (squishSrv == None):
return False
result = subprocess.call(__fixQuotes__('"%s" --config removeAttachableAUT "%s" %s:%s')
% (squishSrv, executable, host, port), shell=True)
result = subprocess.call([squishSrv, "--config", "removeAttachableAUT",
executable, "%s:%s" % (host, port)])
if result == 0:
test.passes("Removed %s as attachable AUT" % executable)
else:
......
......@@ -99,9 +99,8 @@ def waitForCleanShutdown(timeOut=10):
# following work-around because os.kill() works for win not until python 2.7
if appCtxt.pid==-1:
break
tasks = subprocess.Popen("tasklist /FI \"PID eq %d\"" % appCtxt.pid, shell=True,stdout=subprocess.PIPE)
output = tasks.communicate()[0]
tasks.stdout.close()
output = getOutputFromCmdline(["tasklist", "/FI", "PID eq %d" % appCtxt.pid],
acceptedError=1)
if (output=="INFO: No tasks are running which match the specified criteria."
or output=="" or output.find("ERROR")==0):
shutdownDone=True
......@@ -131,14 +130,11 @@ def waitForCleanShutdown(timeOut=10):
def checkForStillRunningQmlExecutable(possibleNames):
for qmlHelper in possibleNames:
tasks = subprocess.Popen("tasklist /FI \"IMAGENAME eq %s\"" % qmlHelper, shell=True,
stdout=subprocess.PIPE)
output = tasks.communicate()[0]
tasks.stdout.close()
output = getOutputFromCmdline(["tasklist", "/FI", "IMAGENAME eq %s" % qmlHelper])
if "INFO: No tasks are running which match the specified criteria." in output:
continue
else:
if subprocess.call("taskkill /F /FI \"IMAGENAME eq %s\"" % qmlHelper, shell=True) == 0:
if subprocess.call(["taskkill", "/F", "/FI", "IMAGENAME eq %s" % qmlHelper]) == 0:
print "Killed still running %s" % qmlHelper
else:
print "%s is still running - failed to kill it" % qmlHelper
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment