修改依赖操作状态判断

This commit is contained in:
whyour
2024-02-14 16:41:14 +08:00
parent 14cb1f7788
commit c47896e787
4 changed files with 45 additions and 30 deletions
+11 -4
View File
@@ -153,10 +153,17 @@ export default class DependenceService {
const docs = await DependenceModel.findAll({ where: { id: ids } });
for (const doc of docs) {
taskLimit.removeQueuedDependency(doc);
const depRunCommand = InstallDependenceCommandTypes[doc.type];
const cmd = `${depRunCommand} ${doc.name.trim()}`;
const pid = await getPid(cmd);
pid && (await killTask(pid));
const depInstallCommand = InstallDependenceCommandTypes[doc.type];
const depUnInstallCommand = unInstallDependenceCommandTypes[doc.type];
const installCmd = `${depInstallCommand} ${doc.name.trim()}`;
const unInstallCmd = `${depUnInstallCommand} ${doc.name.trim()}`;
const pids = await Promise.all([
getPid(installCmd),
getPid(unInstallCmd),
]);
for (const pid of pids) {
pid && (await killTask(pid));
}
}
await this.removeDb(ids);
}