diff --git a/src/vm.ts b/src/vm.ts index 8d3201c..bb7476c 100644 --- a/src/vm.ts +++ b/src/vm.ts @@ -334,12 +334,13 @@ export async function exec(workdir: string, command: string): Promise<{ exitCode /** Pipe input text to Claude in the container with a prompt, returning the output. */ export async function claudePipe(input: string, prompt: string): Promise<{ exitCode: number; stdout: string; stderr: string }> { - const tmpPath = join(homedir(), '.sandlot', '.claude-pipe-tmp') + const tmpName = `.claude-pipe-${crypto.randomUUID()}` + const tmpPath = join(homedir(), '.sandlot', tmpName) try { await Bun.write(tmpPath, input) return await exec( join(homedir(), '.sandlot'), - `cat /sandlot/.claude-pipe-tmp | claude -p "${prompt.replace(/"/g, '\\"')}"`, + `cat /sandlot/${tmpName} | claude -p "${prompt.replace(/"/g, '\\"')}"`, ) } finally { await Bun.file(tmpPath).unlink().catch(() => {})