MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / onStdout

Function onStdout

apps/desktop/src/main/sidecar.ts:295–339  ·  view source on GitHub ↗
(chunk: Buffer)

Source from the content-addressed store, hash-verified

293 };
294
295 const onStdout = (chunk: Buffer) => {
296 const text = chunk.toString("utf8");
297 process.stdout.write(`[executor-server] ${text}`);
298 logStdoutLine(text);
299 stdoutControlBuffer += text;
300 const rawControlLines = stdoutControlBuffer.split(/\r?\n/);
301 stdoutControlBuffer = rawControlLines.pop() ?? "";
302 const stdoutLines = rawControlLines
303 .map((line) => line.trim())
304 .filter((line) => line.length > 0);
305 const readyLine = stdoutLines.find((line) => line.startsWith(`${READY_SENTINEL}:`));
306 if (readyLine && !resolved) {
307 if (!child.pid) {
308 reject(
309 // oxlint-disable-next-line executor/no-error-constructor -- boundary: sidecar startup failure surfaces here as a rejected start promise
310 new Error("Sidecar became ready before Electron reported a child pid."),
311 );
312 return;
313 }
314 resolved = true;
315 const port = parseInt(readyLine.slice(`${READY_SENTINEL}:`.length), 10);
316 const baseUrl = `http://${hostname}:${port}`;
317 if (!cliManagedManifest) {
318 writeSidecarManifest({
319 dataDir,
320 scopeDir,
321 baseUrl,
322 authToken,
323 childPid: child.pid,
324 });
325 }
326 resolveStart({
327 baseUrl,
328 hostname,
329 port,
330 username: SERVER_SETTINGS_USERNAME,
331 authToken,
332 child,
333 supervisedDaemon: false,
334 ownerVersion: app.getVersion() || null,
335 ownerClient: "desktop",
336 ownerExecutablePath: command,
337 });
338 }
339 };
340
341 const onStderr = (chunk: Buffer) => {
342 const text = chunk.toString("utf8");

Callers

nothing calls this directly

Calls 3

rejectFunction · 0.85
writeSidecarManifestFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected