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

Method runRuntime

packages/computer/tests/script-runner-worker.ts:80–99  ·  view source on GitHub ↗
(input: {
    source: string;
    cwd?: string;
    value?: WorkspaceRuntimeValue;
    id?: string;
    env?: Record<string, string>;
    stdin?: string;
  })

Source from the content-addressed store, hash-verified

78 }
79
80 async runRuntime(input: {
81 source: string;
82 cwd?: string;
83 value?: WorkspaceRuntimeValue;
84 id?: string;
85 env?: Record<string, string>;
86 stdin?: string;
87 }) {
88 await this.#workspace.fs.mkdir("/workspace", { recursive: true });
89 const handle = await this.#workspace.runtime.exec(input.source, {
90 backend: "worker-javascript",
91 cwd: input.cwd,
92 input: input.value,
93 id: input.id,
94 env: input.env,
95 stdin: input.stdin,
96 encoding: "utf8",
97 });
98 return { id: handle.id, result: await handle.result() };
99 }
100
101 async startRuntime(input: { source: string; id: string }) {
102 await this.#workspace.fs.mkdir("/workspace", { recursive: true });

Callers 1

fetchMethod · 0.80

Calls 3

mkdirMethod · 0.65
execMethod · 0.65
resultMethod · 0.65

Tested by

no test coverage detected