From e4ae2154afa892feca465e268ba3c0b9eaa89c6e Mon Sep 17 00:00:00 2001 From: 7418 <7418@openclaw.ai> Date: Fri, 6 Feb 2026 23:06:52 +0800 Subject: [PATCH] fix: pass env to SDK subprocess and hide server Dock icon 1. Explicitly pass process.env to the Claude Agent SDK's env option, ensuring user shell env vars (ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL, etc.) reach the claude subprocess in packaged builds. 2. Spawn the standalone server via /bin/sh with exec to prevent the Electron binary from appearing as a separate Dock icon on macOS. Co-Authored-By: Claude Opus 4.6 --- electron/main.ts | 5 ++++- src/lib/claude-client.ts | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/electron/main.ts b/electron/main.ts index 6fe7bd9..c13e150 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -122,7 +122,10 @@ function startServer(port: number): ChildProcess { PATH: `${basePath}:${home}/.npm-global/bin:${home}/.local/bin:${home}/.claude/bin:${shellPath}`, }; - const child = spawn(nodePath, [serverPath], { + // Spawn via /bin/sh to prevent the Electron binary from appearing + // as a separate Dock icon on macOS (even with ELECTRON_RUN_AS_NODE=1, + // macOS may show a Dock entry for the Electron Framework binary). + const child = spawn('/bin/sh', ['-c', `exec "${nodePath}" "${serverPath}"`], { env, stdio: 'pipe', cwd: standaloneDir, diff --git a/src/lib/claude-client.ts b/src/lib/claude-client.ts index 5b49268..76ff14a 100644 --- a/src/lib/claude-client.ts +++ b/src/lib/claude-client.ts @@ -137,6 +137,10 @@ export function streamClaude(options: ClaudeStreamOptions): ReadableStream, }; // Find claude binary for packaged app where PATH is limited