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

Function exec

packages/computer/src/workspace.test.ts:154–166  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

152function execBackend(id: string, onExec: (command: string) => void): WorkspaceBackend {
153 const shell: import("@cloudflare/computer-rpc").ShellRPC = {
154 async exec(input) {
155 onExec(input.command);
156 const execId = input.id ?? `${id}-${Math.random().toString(36).slice(2)}`;
157 return {
158 id: execId,
159 events: new ReadableStream<import("@cloudflare/computer-rpc").ExecEvent>({
160 start(c) {
161 c.enqueue({ id: execId, seq: 1, name: "exit", value: 0 });
162 c.close();
163 },
164 }),
165 };
166 },
167 getExec: () => Promise.reject(new Error("not used")),
168 killExec: () => Promise.reject(new Error("not used")),
169 disposeExec: () => Promise.reject(new Error("not used")),

Callers

nothing calls this directly

Calls 4

onExecFunction · 0.85
eventsFunction · 0.85
sourceEventsFunction · 0.85
toStringMethod · 0.65

Tested by

no test coverage detected