(
sandbox: E2BSandbox,
outputSandboxPath: string,
options?: { user?: string }
)
| 160 | } |
| 161 | |
| 162 | async function readSandboxOutputFile( |
| 163 | sandbox: E2BSandbox, |
| 164 | outputSandboxPath: string, |
| 165 | options?: { user?: string } |
| 166 | ): Promise<string | undefined> { |
| 167 | try { |
| 168 | if (shouldReadSandboxPathAsBase64(outputSandboxPath)) { |
| 169 | const b64Result = await sandbox.commands.run(`base64 -w0 "${outputSandboxPath}"`, options) |
| 170 | return b64Result.stdout |
| 171 | } |
| 172 | return await sandbox.files.read(outputSandboxPath) |
| 173 | } catch (error) { |
| 174 | logger.warn('Failed to read requested sandbox output file', { |
| 175 | outputSandboxPath, |
| 176 | error: error instanceof Error ? error.message : String(error), |
| 177 | }) |
| 178 | return undefined |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | function requestedOutputSandboxPaths(req: { |
| 183 | outputSandboxPath?: string |
no test coverage detected