MCPcopy
hub / github.com/coder/mux / executeBash

Function executeBash

tests/ipc/workspace/remove.test.ts:54–70  ·  view source on GitHub ↗

* Execute bash command in workspace context (works for both local and SSH)

(
  env: TestEnvironment,
  workspaceId: string,
  command: string
)

Source from the content-addressed store, hash-verified

52 * Execute bash command in workspace context (works for both local and SSH)
53 */
54async function executeBash(
55 env: TestEnvironment,
56 workspaceId: string,
57 command: string
58): Promise<{ output: string; exitCode: number }> {
59 const result = await env.orpc.workspace.executeBash({ workspaceId, script: command });
60
61 if (!result.success || !result.data) {
62 const errorMessage = "error" in result ? result.error : "unknown error";
63 throw new Error(
64 `Bash execution failed for "${command}" (workspace=${workspaceId}): ${errorMessage}`
65 );
66 }
67
68 const bashResult = result.data;
69 return { output: bashResult.output ?? "", exitCode: bashResult.exitCode };
70}
71
72/**
73 * Check if workspace directory exists (runtime-agnostic)

Callers 4

createMockORPCClientFunction · 0.85
workspaceExistsFunction · 0.85
makeWorkspaceDirtyFunction · 0.85
remove.test.tsFile · 0.85

Calls 1

executeBashMethod · 0.80

Tested by

no test coverage detected