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

Function pull

packages/computer/src/shell.ts:389–411  ·  view source on GitHub ↗
(controller)

Source from the content-addressed store, hash-verified

387 const stream = new ReadableStream<WorkspaceExecEvent<E>>(
388 {
389 async pull(controller) {
390 try {
391 const next = await reader.read();
392 if (!next.done) {
393 controller.enqueue(next.value);
394 return;
395 }
396 reader.releaseLock();
397 const pulled = await runPostPull(sync);
398 resolveOutcome(pulled);
399 controller.close();
400 } catch (error) {
401 try {
402 reader.releaseLock();
403 } catch {}
404 resolveOutcome({
405 applied: 0,
406 skipped: [],
407 sync: { status: "pending", applied: 0, skipped: [], error: safeErrorMessage(error) },
408 });
409 controller.error(error);
410 }
411 },
412 async cancel(reason) {
413 try {
414 await reader.cancel(reason);

Callers

nothing calls this directly

Calls 6

runPostPullFunction · 0.85
safeErrorMessageFunction · 0.85
finishFunction · 0.85
readMethod · 0.65
closeMethod · 0.65
errorMethod · 0.65

Tested by

no test coverage detected