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

Function onStdout

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

Source from the content-addressed store, hash-verified

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