From 9cc2693c5faad3a95f6bdb4490328a8351e3da59 Mon Sep 17 00:00:00 2001 From: Kiet Ho Date: Wed, 18 Feb 2026 15:46:24 -0800 Subject: [PATCH] fix(desktop): use execWithShellEnv for gh CLI in getPrInfo getPrInfo was using execFileAsync with getGitEnv() to call `gh pr view`, which doesn't have the ENOENT retry logic needed on macOS when the app is launched from Finder/Dock (minimal PATH). Switch to execWithShellEnv which lazily derives the user's shell PATH on command-not-found, matching the pattern used by other gh CLI calls in github.ts and git-operations.ts. --- .../src/lib/trpc/routers/workspaces/utils/git.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/desktop/src/lib/trpc/routers/workspaces/utils/git.ts b/apps/desktop/src/lib/trpc/routers/workspaces/utils/git.ts index 4266da1e2b2..de2d7f32213 100644 --- a/apps/desktop/src/lib/trpc/routers/workspaces/utils/git.ts +++ b/apps/desktop/src/lib/trpc/routers/workspaces/utils/git.ts @@ -9,7 +9,11 @@ import friendlyWords = require("friendly-words"); import type { BranchPrefixMode } from "@superset/local-db"; import simpleGit, { type StatusResult } from "simple-git"; import { runWithPostCheckoutHookTolerance } from "../../utils/git-hook-tolerance"; -import { checkGitLfsAvailable, getShellEnvironment } from "./shell-env"; +import { + checkGitLfsAvailable, + execWithShellEnv, + getShellEnvironment, +} from "./shell-env"; const execFileAsync = promisify(execFile); @@ -1681,10 +1685,8 @@ export async function getPrInfo({ repo: string; prNumber: number; }): Promise { - const env = await getGitEnv(); - try { - const { stdout } = await execFileAsync( + const { stdout } = await execWithShellEnv( "gh", [ "pr", @@ -1695,7 +1697,7 @@ export async function getPrInfo({ "--json", "number,title,headRefName,headRepository,headRepositoryOwner,isCrossRepository", ], - { env, timeout: 30_000 }, + { timeout: 30_000 }, ); return JSON.parse(stdout) as PullRequestInfo;