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

Function onStdout

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

Source from the content-addressed store, hash-verified

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