Mercurial > hg > config
comparison python/process.py @ 183:748c232c0af3
update to process examiner
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Thu, 24 Nov 2011 14:41:09 -0800 |
| parents | f9863f733344 |
| children | 581436742074 |
comparison
equal
deleted
inserted
replaced
| 182:f9863f733344 | 183:748c232c0af3 |
|---|---|
| 22 split = line.split(None, len(header)-1) | 22 split = line.split(None, len(header)-1) |
| 23 process_dict = dict(zip(header, split)) | 23 process_dict = dict(zip(header, split)) |
| 24 retval.append(process_dict) | 24 retval.append(process_dict) |
| 25 return retval | 25 return retval |
| 26 | 26 |
| 27 def running_processes(name, defunct=True): | 27 def running_processes(name, psarg='axwww', defunct=True): |
| 28 """ | 28 """ |
| 29 returns a list of 2-tuples of running processes: | 29 returns a list of 2-tuples of running processes: |
| 30 (pid, ['path/to/executable', 'args', '...']) | 30 (pid, ['path/to/executable', 'args', '...']) |
| 31 with the executable named `name`. | 31 with the executable named `name`. |
| 32 - defunct: whether to return defunct processes | 32 - defunct: whether to return defunct processes |
| 33 """ | 33 """ |
| 34 retval = [] | 34 retval = [] |
| 35 for process in ps(): | 35 for process in ps(psarg): |
| 36 command = process['COMMAND'] | 36 command = process['COMMAND'] |
| 37 command = shlex.split(command) | 37 command = shlex.split(command) |
| 38 if command[-1] == '<defunct>': | 38 if command[-1] == '<defunct>': |
| 39 command = command[:-1] | 39 command = command[:-1] |
| 40 if not command or not defunct: | 40 if not command or not defunct: |
