chrome/updater/test/service/win/proc_util.py
def GetPIDsWithName(image_name, session=None):
  """Gets all process PIDs, with the given image name.

  Args:
    image_name: Case-insensitive process image name.
    session: Session filter. Only search processes within given session.
        None means no filter.

  Returns:
    A list of process ID.
  """
  cmd = ['tasklist', '/FO:csv', '/NH', '/FI', 'IMAGENAME eq %s' % image_name]
  if session is not None:
    cmd.extend(['/FI', 'SESSION eq %s' % session])
  proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

  stdout, stderr = proc.communicate()
  if proc.returncode != 0:
    logging.error('Unable to list processes, %s', stderr)
    return []

  stdout = stdout.decode('ascii').splitlines()
  return [int(row[1]) for row in csv.reader(stdout, delimiter=',')]
Gets all process PIDs, with the given image name.

  Args:
    image_name: Case-insensitive process image name.
    session: Session filter. Only search processes within given session.
        None means no filter.

  Returns:
    A list of process ID.
  
Gets all process PIDs, with the given image name.
Gets all process PIDs with the given image name .
def GetPIDsWithName(image_name, session=None):
  cmd = ['tasklist', '/FO:csv', '/NH', '/FI', 'IMAGENAME eq %s' % image_name]
  if session is not None:
    cmd.extend(['/FI', 'SESSION eq %s' % session])
  proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  stdout, stderr = proc.communicate()
  if proc.returncode != 0:
    logging.error('Unable to list processes, %s', stderr)
    return []
  stdout = stdout.decode('ascii').splitlines()
  return [int(row[1]) for row in csv.reader(stdout, delimiter=',')]
def GetPIDsWithName ( image_name , session = None ) : cmd = [ 'tasklist' , '/FO:csv' , '/NH' , '/FI' , 'IMAGENAME eq %s' % image_name ] if session is not None : cmd . extend ( [ '/FI' , 'SESSION eq %s' % session ] ) proc = subprocess . Popen ( cmd , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) stdout , stderr = proc . communicate ( ) if proc . returncode != 0 : logging . error ( 'Unable to list processes, %s' , stderr ) return [ ] stdout = stdout . decode ( 'ascii' ) . splitlines ( ) return [ int ( row [ 1 ] ) for row in csv . reader ( stdout , delimiter = ',' ) ]
Gets all process PIDs, with the given image name.
Gets all process PIDs with the given image name .
"""Gets all process PIDs, with the given image name.

  Args:
    image_name: Case-insensitive process image name.
    session: Session filter. Only search processes within given session.
        None means no filter.

  Returns:
    A list of process ID.
  """
A list of process ID.
A list of process ID .
image_name
Case-insensitive process image name.
Case - insensitive process image name .
session
Session filter. Only search processes within given session.
None means no filter.
Session filter . Only search processes within given session . None means no filter .