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

Function sockets

graph-ui/tools/lib/socket-sampler.mjs:64–82  ·  view source on GitHub ↗
(pids)

Source from the content-addressed store, hash-verified

62}
63
64async function sockets(pids) {
65 if (pids.length === 0) {
66 return { lines: [], error: null };
67 }
68 try {
69 const { stdout } = await execFileAsync(
70 'lsof',
71 ['-a', '-i', '-n', '-P', '-p', pids.join(',')],
72 { maxBuffer: 8 * 1024 * 1024 },
73 );
74 return { lines: stdout.split('\n').filter((line) => line.trim().length > 0), error: null };
75 } catch (err) {
76 // Exit 1 heisst bei lsof "nichts gefunden", nicht "kaputt".
77 if (err && err.code === 1) {
78 return { lines: [], error: null };
79 }
80 return { lines: [], error: err && err.message ? err.message : String(err) };
81 }
82}
83
84/**
85 * Den eigenen Prozessbaum abtasten, bis `stop()` gerufen wird.

Callers 1

onceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected