diff --git a/src/ssn/getPatch.ts b/src/ssn/getPatch.ts index 08c2496..0239d27 100644 --- a/src/ssn/getPatch.ts +++ b/src/ssn/getPatch.ts @@ -175,7 +175,11 @@ export default async function getPatch({ product, from, to, sourceDirectory, tar } //run tasks - await taskManager(tasks, 5); + try { + await taskManager(tasks, 5); + } catch (error) { + throw new Error(error); + } //TODO: add option to delete downloaded files once patching is complete } diff --git a/src/ssn/patcher-installer/taskManager.ts b/src/ssn/patcher-installer/taskManager.ts index 3e51068..ebd1008 100644 --- a/src/ssn/patcher-installer/taskManager.ts +++ b/src/ssn/patcher-installer/taskManager.ts @@ -12,9 +12,8 @@ export default function taskManager(tasks: Array<() => Promise>, maxConcur } else { //If there is at least one task left, complete it const curTask = remainingTasks.pop() as () => Promise; - const curPromise = curTask(); currentlyRunningTasks += 1; - curPromise.then(() => { + curTask().then(() => { currentlyRunningTasks -= 1; return startNewTask(); }).catch((error) => {