From 7eb8b1f46bced47c6092e936a035c35c0aacf346 Mon Sep 17 00:00:00 2001 From: wassname <1103714+wassname@users.noreply.github.com> Date: Sun, 6 Sep 2026 19:08:27 +0800 Subject: [PATCH] Treat stale pane close as successful cleanup Co-Authored-By: PI[gpt-5.6-sol] <288921227+claudypoo@users.noreply.github.com> --- src/herdr.ts | 2 +- test/herdr.test.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/herdr.ts b/src/herdr.ts index bc80bfc..708aab5 100644 --- a/src/herdr.ts +++ b/src/herdr.ts @@ -76,7 +76,7 @@ export async function openSupervisorPane(input: LaunchSupervisorInput): Promise< await herdr(["pane", "run", paneId, supervisorCommand(input)]); return paneId; } catch (error) { - await herdr(["pane", "close", paneId]); + await closeSupervisorPane(paneId); throw error; } } diff --git a/test/herdr.test.ts b/test/herdr.test.ts index db5ef40..a95b71d 100644 --- a/test/herdr.test.ts +++ b/test/herdr.test.ts @@ -37,7 +37,7 @@ describe("supervisor pane command", () => { writeFileSync(bin, `#!/bin/sh if [ "$1" = "--version" ]; then echo "herdr 0.8.2"; exit 0; fi if [ "$1" = "pane" ] && [ "$2" = "split" ]; then echo '{"pane_id":"new-pane"}'; exit 0; fi -if [ "$1" = "pane" ] && [ "$2" = "run" ]; then echo '{}'; exit 0; fi +if [ "$1" = "pane" ] && [ "$2" = "run" ]; then if [ "$HERDR_SMOKE_RUN_FAIL" = "1" ]; then echo "run failed" >&2; exit 1; fi; echo '{}'; exit 0; fi if [ "$1" = "pane" ] && [ "$2" = "close" ]; then echo '{"error":{"code":"PANE_GONE"}}' >&2; exit 1; fi exit 2 `); @@ -47,6 +47,8 @@ exit 2 try { await expect(openSupervisorPane(input())).resolves.toBe("new-pane"); await expect(closeSupervisorPane("new-pane")).resolves.toBeUndefined(); + vi.stubEnv("HERDR_SMOKE_RUN_FAIL", "1"); + await expect(openSupervisorPane(input())).rejects.toThrow("run failed"); } finally { rmSync(cwd, { recursive: true, force: true }); }