Bug 698010 - Make deviceManagerADB.py killProcess method actually work. r=jmaher

This commit is contained in:
William Lachance 2011-11-09 12:08:04 -05:00
parent ede3bf1dcd
commit 638a5977f9

View File

@ -256,11 +256,11 @@ class DeviceManagerADB(DeviceManager):
# failure: None
def killProcess(self, appname):
procs = self.getProcessList()
for proc in procs:
if (proc[1] == appname):
p = self.runCmd(["shell", "ps"])
for (pid, name, user) in procs:
if name == appname:
p = self.runCmdAs(["shell", "kill", pid])
return p.stdout.read()
return None
return None
# external function
# returns:
@ -506,6 +506,12 @@ class DeviceManagerADB(DeviceManager):
args.insert(0, "adb")
return subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
def runCmdAs(self, args):
if self.useRunAs:
args.insert(1, "run-as")
args.insert(2, self.packageName)
return self.runCmd(args)
def checkCmd(self, args):
args.insert(0, "adb")
return subprocess.check_call(args)