MCPcopy
hub / github.com/lowdefy/lowdefy / createLineHandler

Function createLineHandler

scripts/dev.mjs:177–187  ·  view source on GitHub ↗
(handler)

Source from the content-addressed store, hash-verified

175});
176
177function createLineHandler(handler) {
178 let buffer = '';
179 return (data) => {
180 const text = buffer + data.toString('utf8');
181 const lines = text.split('\n');
182 buffer = lines.pop();
183 lines.forEach((line) => {
184 if (line) handler(line);
185 });
186 };
187}
188
189child.stdout.on('data', createLineHandler(stdOutLineHandler));
190child.stderr.on('data', createLineHandler(stdOutLineHandler));

Callers 1

dev.mjsFile · 0.85

Calls 1

handlerFunction · 0.50

Tested by

no test coverage detected