Return a process' state, such as "stopped" or "running".
(pid)
| 80 | |
| 81 | |
| 82 | def process_state(pid): |
| 83 | """Return a process' state, such as "stopped" or "running".""" |
| 84 | status = LocalPath('/proc').join(str(pid), 'status').read() |
| 85 | m = re.search(r'^State:\s+[A-Z] \(([a-z]+)\)$', status, re.MULTILINE) |
| 86 | return m.group(1) |
| 87 | |
| 88 | |
| 89 | def sleep_until(fn, timeout=1.5): |
no outgoing calls