def get_pids(name): """Get all the pids matching name""" if mozinfo.isWin: # use the windows-specific implementation import wpk return wpk.get_pids(name) else: return [pid for pid,_ in running_processes(name)]
def get_pids(name, minimun_pid=0): """Get all the pids matching name, exclude any pids below minimum_pid.""" if os.name == 'nt' or sys.platform == 'cygwin': import wpk pids = wpk.get_pids(name) else: data = getoutput(['ps', 'ax']).splitlines() pids = [int(line.split()[0]) for line in data if line.find(name) is not -1] matching_pids = [m for m in pids if m > minimun_pid] return matching_pids
def get_pids(name, minimun_pid=0): """Get all the pids matching name, exclude any pids below minimum_pid.""" if mozinfo.isWin: # use the windows-specific implementation import wpk pids = wpk.get_pids(name) else: process = subprocess.Popen(['ps', 'ax'], stdout=subprocess.PIPE) output, _ = process.communicate() data = output.splitlines() pids = [int(line.split()[0]) for line in data if line.find(name) is not -1] return [m for m in pids if m > minimun_pid]
def get_pids(name, minimun_pid=0): """Get all the pids matching name, exclude any pids below minimum_pid.""" # XXX see also https://bugzilla.mozilla.org/show_bug.cgi?id=592750 if os.name == 'nt' or sys.platform == 'cygwin': import wpk pids = wpk.get_pids(name) else: process = subprocess.Popen(['ps', 'ax'], stdout=subprocess.PIPE) output, _ = process.communicate() data = output.splitlines() pids = [int(line.split()[0]) for line in data if line.find(name) is not -1] matching_pids = [m for m in pids if m > minimun_pid] return matching_pids
def get_pids(name, minimun_pid=0): """Get all the pids matching name, exclude any pids below minimum_pid.""" if os.name == "nt" or sys.platform == "cygwin": import wpk pids = wpk.get_pids(name) else: # get_pids_cmd = ['ps', 'ax'] # h = killableprocess.runCommand(get_pids_cmd, stdout=subprocess.PIPE, universal_newlines=True) # h.wait(group=False) # data = h.stdout.readlines() data = getoutput(["ps", "ax"]).splitlines() pids = [int(line.split()[0]) for line in data if line.find(name) is not -1] matching_pids = [m for m in pids if m > minimun_pid] return matching_pids
def get_pids(name, minimun_pid=0): """Get all the pids matching name, exclude any pids below minimum_pid.""" # XXX see also https://bugzilla.mozilla.org/show_bug.cgi?id=592750 if os.name == 'nt' or sys.platform == 'cygwin': import wpk pids = wpk.get_pids(name) else: process = subprocess.Popen(['ps', 'ax'], stdout=subprocess.PIPE) output, _ = process.communicate() data = output.splitlines() pids = [ int(line.split()[0]) for line in data if line.find(name) is not -1 ] matching_pids = [m for m in pids if m > minimun_pid] return matching_pids
def get_pids(name, minimun_pid=0): """Get all the pids matching name, exclude any pids below minimum_pid.""" if os.name == 'nt' or sys.platform == 'cygwin': import wpk pids = wpk.get_pids(name) else: # get_pids_cmd = ['ps', 'ax'] # h = killableprocess.runCommand(get_pids_cmd, stdout=subprocess.PIPE, universal_newlines=True) # h.wait(group=False) # data = h.stdout.readlines() data = getoutput(['ps', 'ax']).splitlines() pids = [int(line.split()[0]) for line in data if line.find(name) is not -1] matching_pids = [m for m in pids if m > minimun_pid] return matching_pids