From 8eabd31442eb93346ff9b9d71ce870076f2621d4 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Wed, 11 Mar 2026 21:50:43 -0700 Subject: [PATCH] Use unique temp file names for Claude pipe --- src/vm.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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(() => {})