From fd7d2b75800bf3ccbf66585eb4379357975e054f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=C2=B7Dong?= <98630204+GeorgeDong32@users.noreply.github.com> Date: Mon, 25 Aug 2025 20:02:13 +0800 Subject: [PATCH] fix(codetool): quote executable path to handle spaces (#9519) * fix(cmd): quote executable path on Windows in command string Wrap the executable path in double quotes when running on Windows sopaths containing spaces are handled correctly. Previously the base command used an unquoted path which could break execution for users whose install location includes spaces. This change only alters the Windows branch to produce a quoted executable path while keeping the non-Windows command unchanged. * fix(codetool): quote bun paths in shell commands to spaces --- src/main/services/CodeToolsService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/services/CodeToolsService.ts b/src/main/services/CodeToolsService.ts index d408ad78a7..28f1068b8f 100644 --- a/src/main/services/CodeToolsService.ts +++ b/src/main/services/CodeToolsService.ts @@ -203,7 +203,7 @@ class CodeToolsService { ? `set "BUN_INSTALL=${bunInstallPath}" && set "NPM_CONFIG_REGISTRY=${registryUrl}" &&` : `export BUN_INSTALL="${bunInstallPath}" && export NPM_CONFIG_REGISTRY="${registryUrl}" &&` - const updateCommand = `${installEnvPrefix} ${bunPath} install -g ${packageName}` + const updateCommand = `${installEnvPrefix} "${bunPath}" install -g ${packageName}` logger.info(`Executing update command: ${updateCommand}`) await execAsync(updateCommand, { timeout: 60000 }) @@ -307,7 +307,7 @@ class CodeToolsService { } // Build command to execute - let baseCommand = isWin ? `${executablePath}` : `${bunPath} ${executablePath}` + let baseCommand = isWin ? `"${executablePath}"` : `"${bunPath}" "${executablePath}"` const bunInstallPath = path.join(os.homedir(), '.cherrystudio') if (isInstalled) {