From 7bace980589fcc96cb7e4191044101f2ba27822d Mon Sep 17 00:00:00 2001 From: Justin Diclemente Date: Fri, 19 Jun 2026 13:09:49 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20safer=20dogbench=20subprocess=20?= =?UTF-8?q?=E2=80=94=20list=20args,=20cwd=3D,=20FileNotFoundError,=20retur?= =?UTF-8?q?ncode=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cli.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cli.py b/cli.py index 1dd191f..74402fb 100644 --- a/cli.py +++ b/cli.py @@ -8503,12 +8503,20 @@ def _handle_benchmark(self, args: str = ""): self._console_print("[yellow]dogbench not installed. Run: git clone https://github.com/specdog/dogbench.git ~/dogbench[/]") return no_submit = "--no-submit" in args - cmd = f"cd {dogbench_dir} && git pull origin main && ./dogbench --json" + (" --no-submit" if no_submit else "") + cmd = ["./dogbench", "--json"] + if no_submit: + cmd.append("--no-submit") self._console_print("[dim]Running benchmark...[/]") - result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=300) + try: + result = subprocess.run(cmd, cwd=dogbench_dir, capture_output=True, text=True, timeout=300) + except FileNotFoundError: + self._console_print("[red]dogbench script not found in ~/dogbench[/]") + return self._console_print(result.stdout) if result.stderr: self._console_print(f"[red]{result.stderr[-500:]}[/]") + if result.returncode != 0: + self._console_print(f"[red]Benchmark exited with code {result.returncode}[/]") def _show_insights(self, command: str = "/insights"): """Show usage insights and analytics from session history."""