MCPcopy Create free account
hub / github.com/cloudflare/computer / spawnFailed

Method spawnFailed

packages/computerd/src/exec/runner.ts:456–474  ·  view source on GitHub ↗
(id: string, err: unknown)

Source from the content-addressed store, hash-verified

454 // detected pre-spawn or as a libuv ECHILD/ENOENT/etc on the
455 // child itself.
456 private spawnFailed(id: string, err: unknown): ExecHandle {
457 const message = err instanceof Error ? err.message : String(err);
458 const log = createLog(this.db, id, {
459 maxBytes: this.opts.logMaxBytes,
460 now: this.opts.now,
461 });
462 const value = new TextEncoder().encode(`spawn failed: ${message}\n`);
463 const stderrSeq = log.append("stderr", value);
464 const exitSeq = log.setExit(-1);
465 log.dispose();
466 const events = new ReadableStream<ExecEvent>({
467 start(controller) {
468 controller.enqueue({ id, seq: stderrSeq, name: "stderr", value });
469 controller.enqueue({ id, seq: exitSeq, name: "exit", value: -1 });
470 controller.close();
471 },
472 });
473 return { id, events };
474 }
475
476 private scheduleSweep(): void {
477 if (this.sweepTimer !== undefined) return;

Callers 1

execMethod · 0.95

Calls 4

createLogFunction · 0.85
setExitMethod · 0.80
appendMethod · 0.65
disposeMethod · 0.65

Tested by

no test coverage detected