From f0a6a0a0af78713ea8c4c3e5e167b3c163674e2a Mon Sep 17 00:00:00 2001 From: AndyMik90 Date: Sat, 20 Dec 2025 12:34:45 +0100 Subject: [PATCH] fix(windows): add platform detection for terminal profile commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use cmd.exe syntax (set/%) on Windows - Use bash syntax (export/$) on Unix/macOS Fixes #51 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../src/main/ipc-handlers/terminal-handlers.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/auto-claude-ui/src/main/ipc-handlers/terminal-handlers.ts b/auto-claude-ui/src/main/ipc-handlers/terminal-handlers.ts index 6091635c..f16d60e5 100644 --- a/auto-claude-ui/src/main/ipc-handlers/terminal-handlers.ts +++ b/auto-claude-ui/src/main/ipc-handlers/terminal-handlers.ts @@ -327,13 +327,19 @@ export function registerTerminalHandlers( await new Promise(resolve => setTimeout(resolve, 500)); // Build the login command with the profile's config dir - // Use export to ensure the variable persists, then run setup-token + // Use platform-specific syntax for environment variables let loginCommand: string; if (!profile.isDefault && profile.configDir) { - // Use export and run in subshell to ensure CLAUDE_CONFIG_DIR is properly set // SECURITY: Use escapeShellArg to prevent command injection via configDir const escapedConfigDir = escapeShellArg(profile.configDir); - loginCommand = `export CLAUDE_CONFIG_DIR=${escapedConfigDir} && echo "Config dir: $CLAUDE_CONFIG_DIR" && claude setup-token`; + + if (process.platform === 'win32') { + // Windows cmd.exe syntax: set "VAR=value" with %VAR% for expansion + loginCommand = `set "CLAUDE_CONFIG_DIR=${profile.configDir}" && echo Config dir: %CLAUDE_CONFIG_DIR% && claude setup-token`; + } else { + // Unix/Mac bash/zsh syntax: export VAR=value with $VAR for expansion + loginCommand = `export CLAUDE_CONFIG_DIR=${escapedConfigDir} && echo "Config dir: $CLAUDE_CONFIG_DIR" && claude setup-token`; + } } else { loginCommand = 'claude setup-token'; }