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
This commit is contained in:
George·Dong 2025-08-25 20:02:13 +08:00 committed by GitHub
parent 57702f545d
commit fd7d2b7580
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) {