MCPcopy Create free account
hub / github.com/EvoMap/evolver / getRunningPids

Function getRunningPids

src/ops/lifecycle.js:106–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

104// --- Process Discovery ---
105
106function getRunningPids() {
107 try {
108 var pids = [];
109 for (var proc of listProcesses()) {
110 var pid = proc.pid;
111 var cmd = (proc.args || '').trim();
112 if (pid === process.pid) continue;
113 var cmdLower = cmd.toLowerCase();
114 // Match any `node ... index.js ... --loop` invocation.
115 // Wrapper path prefix filters were removed so launchd/plist or direct
116 // node invocations are also discovered (fixes #379, #403).
117 if (cmdLower.includes('node') && cmdLower.includes('index.js') && cmdLower.includes('--loop')) {
118 pids.push(pid);
119 }
120 }
121 return [...new Set(pids)].filter(isPidRunning);
122 } catch (e) {
123 return [];
124 }
125}
126
127function isPidRunning(pid) {
128 if (_processTableForTest) {

Callers 5

startFunction · 0.85
stopFunction · 0.85
stopOwnedLoopsFunction · 0.85
statusFunction · 0.85
checkHealthFunction · 0.85

Calls 1

listProcessesFunction · 0.85

Tested by

no test coverage detected