chrome/test/mini_installer/process_operations.py
def CleanProcess(expectation_name, expectation, variable_expander):
    """Terminates processes based on expectations.

    Args:
        expectation_name: Path to a process's executable.
        expectation: A dictionary describing the state of the process:
            'running': A boolean False indicating that the process must not be
                running.
        variable_expander: A VariableExpander object.

    Raises:
        AssertionError: If an expectation is not satisfied.
        WindowsError: If an error occurs while deleting the path.
    """
    process_path = variable_expander.Expand(expectation_name)
    assert not expectation['running'], (
        'Invalid expectation for CleanProcess operation: \'running\' property '
        + 'for %s must not be True' % process_path)

    for proc in psutil.process_iter():
        try:
            if not proc.exe() == process_path:
                continue
        except psutil.Error:
            # Ignore processes for which the path cannot be determined.
            # AccessDenied is expected for pid 0, pid 4, and any others that the
            # current process does not have access to query.
            continue
        pid = proc.pid
        try:
            proc.kill()
            LOGGER.info('CleanProcess killed process %s of pid %s' %
                        (process_path, pid))
        except psutil.NoSuchProcess:
            LOGGER.info('CleanProcess tried to kill process %s of pid %s, ' %
                        (process_path, pid) + 'yet it was already gone')
Terminates processes based on expectations.

    Args:
        expectation_name: Path to a process's executable.
        expectation: A dictionary describing the state of the process:
            'running': A boolean False indicating that the process must not be
                running.
        variable_expander: A VariableExpander object.

    Raises:
        AssertionError: If an expectation is not satisfied.
        WindowsError: If an error occurs while deleting the path.
    
Terminates processes based on expectations.
Terminates processes based on expectations .
def CleanProcess(expectation_name, expectation, variable_expander):
    process_path = variable_expander.Expand(expectation_name)
    assert not expectation['running'], (
        'Invalid expectation for CleanProcess operation: \'running\' property '
        + 'for %s must not be True' % process_path)
    for proc in psutil.process_iter():
        try:
            if not proc.exe() == process_path:
                continue
        except psutil.Error:
            continue
        pid = proc.pid
        try:
            proc.kill()
            LOGGER.info('CleanProcess killed process %s of pid %s' %
                        (process_path, pid))
        except psutil.NoSuchProcess:
            LOGGER.info('CleanProcess tried to kill process %s of pid %s, ' %
                        (process_path, pid) + 'yet it was already gone')
def CleanProcess ( expectation_name , expectation , variable_expander ) : process_path = variable_expander . Expand ( expectation_name ) assert not expectation [ 'running' ] , ( 'Invalid expectation for CleanProcess operation: \'running\' property ' + 'for %s must not be True' % process_path ) for proc in psutil . process_iter ( ) : try : if not proc . exe ( ) == process_path : continue except psutil . Error : continue pid = proc . pid try : proc . kill ( ) LOGGER . info ( 'CleanProcess killed process %s of pid %s' % ( process_path , pid ) ) except psutil . NoSuchProcess : LOGGER . info ( 'CleanProcess tried to kill process %s of pid %s, ' % ( process_path , pid ) + 'yet it was already gone' )
Terminates processes based on expectations.
Terminates processes based on expectations .
"""Terminates processes based on expectations.

    Args:
        expectation_name: Path to a process's executable.
        expectation: A dictionary describing the state of the process:
            'running': A boolean False indicating that the process must not be
                running.
        variable_expander: A VariableExpander object.

    Raises:
        AssertionError: If an expectation is not satisfied.
        WindowsError: If an error occurs while deleting the path.
    """ # Ignore processes for which the path cannot be determined. # AccessDenied is expected for pid 0, pid 4, and any others that the # current process does not have access to query.
If an expectation is not satisfied.
If an expectation is not satisfied .
AssertionError
If an error occurs while deleting the path.
If an error occurs while deleting the path .
WindowsError
expectation_name
Path to a process's executable.
Path to a process ' s executable .
expectation
A dictionary describing the state of the process:
'running': A boolean False indicating that the process must not be
running.
A dictionary describing the state of the process : ' running ' : A boolean False indicating that the process must not be running .
variable_expander
A VariableExpander object.
A VariableExpander object .