Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Bug 931078 - add ability to pass signal to dm.killProcess, r=wlach
Browse files Browse the repository at this point in the history
  • Loading branch information
ahal-test committed Oct 25, 2013
1 parent 5265967 commit c27774f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
9 changes: 6 additions & 3 deletions mozdevice/mozdevice/devicemanager.py
Expand Up @@ -420,10 +420,13 @@ def processExist(self, processName):


@abstractmethod
def killProcess(self, processName, forceKill=False):
def killProcess(self, processName, sig=None):
"""
Kills the process named processName. If forceKill is True, process is
killed regardless of state.
Kills the process named processName. If sig is not None, process is
killed with the specified signal.
:param processName: path or name of the process to kill
:param sig: signal to pass into the kill command (optional)
"""

@abstractmethod
Expand Down
6 changes: 3 additions & 3 deletions mozdevice/mozdevice/devicemanagerADB.py
Expand Up @@ -361,13 +361,13 @@ def launchProcess(self, cmd, outputFile = "process.txt", cwd = '', env = '', fai
self._checkCmd(acmd)
return outputFile

def killProcess(self, appname, forceKill=False):
def killProcess(self, appname, sig=None):
procs = self.getProcessList()
for (pid, name, user) in procs:
if name == appname:
args = ["shell", "kill"]
if forceKill:
args.append("-9")
if sig:
args.append("-%d" % sig)
args.append(str(pid))
p = self._runCmd(args)
p.communicate()
Expand Down
6 changes: 3 additions & 3 deletions mozdevice/mozdevice/devicemanagerSUT.py
Expand Up @@ -525,9 +525,9 @@ def launchProcess(self, cmd, outputFile = "process.txt", cwd = '', env = '', fai
self.fireProcess(cmdline, failIfRunning)
return outputFile

def killProcess(self, appname, forceKill=False):
if forceKill:
self._logger.warn("killProcess(): forceKill parameter unsupported on SUT")
def killProcess(self, appname, sig=None):
if sig:
self._logger.warn("killProcess(): sig parameter unsupported on SUT")
retries = 0
while retries < self.retryLimit:
try:
Expand Down

0 comments on commit c27774f

Please sign in to comment.