Skip to content

Commit

Permalink
修复安装依赖逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
whyour committed May 24, 2022
1 parent 09cca0a commit a8cdab6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion back/loaders/initData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
6 changes: 4 additions & 2 deletions back/services/dependence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit a8cdab6

Please sign in to comment.