* Execute bash command in workspace context (works for both local and SSH)
( env: TestEnvironment, workspaceId: string, command: string )
| 52 | * Execute bash command in workspace context (works for both local and SSH) |
| 53 | */ |
| 54 | async 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) |
no test coverage detected