From e4f7461b627e30955b053fe022ef4fbd70ad6969 Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 25 May 2022 02:04:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=89=E8=A3=85=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/loaders/initData.ts | 2 +- back/services/dependence.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/back/loaders/initData.ts b/back/loaders/initData.ts index a41fb6c9..225e35d3 100644 --- a/back/loaders/initData.ts +++ b/back/loaders/initData.ts @@ -21,7 +21,7 @@ export default async () => { ); // 初始化时安装所有处于安装中,安装成功,安装失败的依赖 - DependenceModel.findAll({ where: {} }).then(async (docs) => { + DependenceModel.findAll({ where: {}, raw: true }).then(async (docs) => { const groups = _.groupBy(docs, 'type'); for (const key in groups) { if (Object.prototype.hasOwnProperty.call(groups, key)) { diff --git a/back/services/dependence.ts b/back/services/dependence.ts index 1d853fbe..30609ed3 100644 --- a/back/services/dependence.ts +++ b/back/services/dependence.ts @@ -105,7 +105,7 @@ export default class DependenceService { ); const docs = await DependenceModel.findAll({ where: { id: ids } }); - await this.installOrUninstallDependencies(docs); + this.installOrUninstallDependencies(docs); return docs; } @@ -146,7 +146,6 @@ export default class DependenceService { )[dependencies[0].type as any]; const actionText = isInstall ? '安装' : '删除'; const depIds = dependencies.map((x) => x.id) as number[]; - const cp = spawn(`${depRunCommand} ${depNames}`, { shell: '/bin/bash' }); const startTime = Date.now(); this.sockService.sendMessage({ type: socketMessageType, @@ -161,6 +160,9 @@ export default class DependenceService { startTime, ).toLocaleString()}\n\n`, ); + + const cp = spawn(`${depRunCommand} ${depNames}`, { shell: '/bin/bash' }); + cp.stdout.on('data', async (data) => { this.sockService.sendMessage({ type: socketMessageType,