diff --git a/packages/server/src/tools.ts b/packages/server/src/tools.ts index bf95a91..137f777 100644 --- a/packages/server/src/tools.ts +++ b/packages/server/src/tools.ts @@ -61,7 +61,7 @@ function sanitizeCommand(cmd: string): string { export async function exec(args: { command: string; cwd?: string; timeout?: number }): Promise { const command = sanitizeCommand(args.command); - const cwd = args.cwd ? safePath(args.cwd) : process.cwd(); + const cwd = safePath(args.cwd ?? "."); try { const stdout = execSync(command, { cwd, timeout: args.timeout ?? 30000, encoding: "utf8", maxBuffer: 10*1024*1024, stdio: ["pipe","pipe","pipe"] }); return { ok: true, stdout: stdout.toString(), stderr: "" };