MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / process_identity

Function process_identity

tests/test_daemon_smoke.py:127–154  ·  view source on GitHub ↗

Return (ppid, pgid, state) for a live non-zombie process.

(pid)

Source from the content-addressed store, hash-verified

125
126
127def process_identity(pid):
128 """Return (ppid, pgid, state) for a live non-zombie process."""
129 result = subprocess.run(
130 [
131 "ps",
132 "-p",
133 str(pid),
134 "-o",
135 "ppid=",
136 "-o",
137 "pgid=",
138 "-o",
139 "stat=",
140 ],
141 stdout=subprocess.PIPE,
142 stderr=subprocess.DEVNULL,
143 text=True,
144 check=False,
145 )
146 if result.returncode != 0:
147 return None
148 try:
149 ppid, pgid, state = result.stdout.split(None, 2)
150 if state.startswith("Z"):
151 return None
152 return int(ppid), int(pgid), state
153 except (TypeError, ValueError):
154 return None
155
156
157def worker_tree_identity_matches(

Callers 3

worker_is_stoppedFunction · 0.85

Calls 2

strFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected