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

Function exec

packages/computer/tests/worker-backend.test.ts:69–79  ·  view source on GitHub ↗
(
  id: string,
  command: string,
)

Source from the content-addressed store, hash-verified

67}
68
69async function exec(
70 id: string,
71 command: string,
72): Promise<{ exitCode: number; stdout: string; stderr: string }> {
73 const url = new URL("http://test/exec");
74 url.searchParams.set("id", id);
75 url.searchParams.set("command", command);
76 const res = await SELF.fetch(url);
77 if (!res.ok) throw new Error(`exec failed: ${res.status} ${await res.text()}`);
78 return res.json();
79}
80
81describe("WorkerShellBackend end-to-end", () => {
82 // Per-test timeouts come from vitest.config.worker-backend.ts's

Callers 1

Calls 4

setMethod · 0.65
fetchMethod · 0.65
textMethod · 0.65
jsonMethod · 0.65

Tested by

no test coverage detected