def get_pids(pattern):
    logger.debug('get_pids: %s', pattern)
    cmd = "pgrep -fl '%s'" % pattern
    p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
    out = p.communicate()[0]
    logger.debug("\n%s", out)
    lines = out.splitlines()
    lines = [l.decode() for l in lines]
    lines = [l.split(" ", 1) for l in lines]
    lines = [(pid, cmd) for (pid, cmd) in lines if not cmd.startswith(("sh", "/bin/sh"))]
    pids = [int(pid) for (pid, cmd) in lines]
    logger.debug('pids: %s', pids)
    return pids
dataset/ETHPy150Open cenk/kuyruk/tests/integration/util.py/get_pids/original