MCPcopy
hub / github.com/RedPlanetHQ/core / isProcessRunning

Function isProcessRunning

packages/cli/src/utils/coding-runner.ts:224–238  ·  view source on GitHub ↗
(sessionId: string)

Source from the content-addressed store, hash-verified

222}
223
224export function isProcessRunning(sessionId: string): boolean {
225 // Primary source: PtyManager in-memory state for agents spawned under this
226 // daemon. Falls back to PID-probe for legacy session records that may have
227 // been started before the PTY refactor.
228 if (ptyManager.isRunning(sessionId)) return true;
229
230 const session = getSession(sessionId);
231 if (!session?.pid) return false;
232 try {
233 process.kill(session.pid, 0);
234 return true;
235 } catch {
236 return false;
237 }
238}
239
240export function stopProcess(sessionId: string): boolean {
241 if (ptyManager.isRunning(sessionId)) {

Callers 5

tickFunction · 0.90
waitForProcessExitFunction · 0.90
handleAskFunction · 0.90
checkFunction · 0.90
handleReadSessionFunction · 0.90

Calls 3

getSessionFunction · 0.90
isRunningMethod · 0.80
killMethod · 0.80

Tested by

no test coverage detected