(dirPath: string, abortSignal?: AbortSignal)
| 403 | } |
| 404 | |
| 405 | private async ensureDirViaExec(dirPath: string, abortSignal?: AbortSignal): Promise<void> { |
| 406 | const stream = await this.exec(`mkdir -p ${this.quoteForContainer(dirPath)}`, { |
| 407 | cwd: "/", |
| 408 | timeout: 10, |
| 409 | abortSignal, |
| 410 | }); |
| 411 | |
| 412 | await stream.stdin.close(); |
| 413 | |
| 414 | const [stdout, stderr, exitCode] = await Promise.all([ |
| 415 | streamToString(stream.stdout), |
| 416 | streamToString(stream.stderr), |
| 417 | stream.exitCode, |
| 418 | ]); |
| 419 | |
| 420 | if (exitCode !== 0) { |
| 421 | const extra = stderr.trim() || stdout.trim(); |
| 422 | throw new RuntimeError( |
| 423 | `Failed to create directory ${dirPath}: exit code ${exitCode}${extra ? `: ${extra}` : ""}`, |
| 424 | "file_io" |
| 425 | ); |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | private async statViaExec(filePath: string, abortSignal?: AbortSignal): Promise<FileStat> { |
| 430 | // -L follows symlinks so symlinked paths report the target's type |
no test coverage detected