From 453800032e8e0b2b6e8bf40f1fd66d5a84aac8c6 Mon Sep 17 00:00:00 2001 From: Wendong-Fan Date: Mon, 29 Sep 2025 01:09:49 +0800 Subject: [PATCH 1/2] Fix #352 install enhanced PR404 --- backend/app/component/command.py | 2 +- electron/main/index.ts | 13 ++++++------- electron/main/install-deps.ts | 18 ++++++++++-------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/backend/app/component/command.py b/backend/app/component/command.py index 1b320dc8..0f8e549a 100644 --- a/backend/app/component/command.py +++ b/backend/app/component/command.py @@ -6,4 +6,4 @@ def bun(): def uv(): - return os.path.expanduser("~/.eigent/bin/uv") + return os.path.expanduser("~/.local/bin/uv") diff --git a/electron/main/index.ts b/electron/main/index.ts index e070e1ab..f9bfe0f0 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -19,7 +19,6 @@ import { zipFolder } from './utils/log' import axios from 'axios'; import FormData from 'form-data'; import { checkAndInstallDepsOnUpdate, PromiseReturnType, getInstallationStatus } from './install-deps' -import e from 'express' const userData = app.getPath('userData'); @@ -841,7 +840,7 @@ function registerIpcHandlers() { ipcMain.handle('check-tool-installed', async () => { try { const isInstalled = await checkToolInstalled(); - return { success: true, isInstalled }; + return { success: true, isInstalled: isInstalled.success }; } catch (error) { return { success: false, error: (error as Error).message }; } @@ -987,21 +986,21 @@ const checkAndStartBackend = async () => { log.info('Checking and starting backend service...'); try { const isToolInstalled = await checkToolInstalled(); - if (isToolInstalled) { + if (isToolInstalled.success) { log.info('Tool installed, starting backend service...'); - + // Notify frontend installation success if (win && !win.isDestroyed()) { win.webContents.send('install-dependencies-complete', { success: true, code: 0 }); } - + python_process = await startBackend((port) => { backendPort = port; log.info('Backend service started successfully', { port }); }); - + python_process?.on('exit', (code, signal) => { - + log.info('Python process exited', { code, signal }); }); } else { diff --git a/electron/main/install-deps.ts b/electron/main/install-deps.ts index 9c251b62..1fbb4dde 100644 --- a/electron/main/install-deps.ts +++ b/electron/main/install-deps.ts @@ -100,7 +100,7 @@ Promise => { * Check if command line tools are installed, install if not */ export async function installCommandTool(): Promise { - return new Promise(async (resolve, reject) => { + try { const ensureInstalled = async (toolName: 'uv' | 'bun', scriptName: string): Promise => { if (await isBinaryExists(toolName)) { return { message: `${toolName} already installed`, success: true }; @@ -123,24 +123,26 @@ export async function installCommandTool(): Promise { }); } - return { + return { message: installed ? `${toolName} installed successfully` : `${toolName} installation failed`, - success: installed + success: installed }; }; const uvResult = await ensureInstalled('uv', 'install-uv.js'); if (!uvResult.success) { - return reject({ message: uvResult.message, success: false }); + return { message: uvResult.message, success: false }; } - + const bunResult = await ensureInstalled('bun', 'install-bun.js'); if (!bunResult.success) { - return reject({ message: bunResult.message, success: false }); + return { message: bunResult.message, success: false }; } - return resolve({ message: "Command tools installed successfully", success: true }); - }) + return { message: "Command tools installed successfully", success: true }; + } catch (error) { + return { message: `Command tool installation failed: ${error}`, success: false }; + } } let uv_path:string; From b5e887a7161d0efca79365ee057e7ffed885d430 Mon Sep 17 00:00:00 2001 From: Wendong-Fan Date: Tue, 30 Sep 2025 23:55:49 +0800 Subject: [PATCH 2/2] update --- backend/app/component/command.py | 2 +- electron/main/init.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/app/component/command.py b/backend/app/component/command.py index 0f8e549a..1b320dc8 100644 --- a/backend/app/component/command.py +++ b/backend/app/component/command.py @@ -6,4 +6,4 @@ def bun(): def uv(): - return os.path.expanduser("~/.local/bin/uv") + return os.path.expanduser("~/.eigent/bin/uv") diff --git a/electron/main/init.ts b/electron/main/init.ts index f993b60d..70924403 100644 --- a/electron/main/init.ts +++ b/electron/main/init.ts @@ -21,10 +21,12 @@ export async function checkToolInstalled() { return new Promise(async (resolve, reject) => { if (!(await isBinaryExists('uv'))) { resolve({success: false, message: "uv doesn't exist"}) + return } if (!(await isBinaryExists('bun'))) { resolve({success: false, message: "Bun doesn't exist"}) + return } resolve({success: true, message: "Tools exist already"})