Add tasks.setCompleted

this lets us easily grep the code on where the task is completed
This commit is contained in:
Girish Ramakrishnan
2019-09-05 11:29:46 -07:00
parent 9769fbfcf2
commit 0843f78ec8
3 changed files with 34 additions and 18 deletions
+1 -2
View File
@@ -59,12 +59,11 @@ initialize(function (error) {
const resultCallback = (error, result) => {
// Error object has properties with enumerable: false (https://mattcbaker.com/posts/stringify-javascript-error/)
const progress = {
percent: 100,
result: result || null,
error: error ? JSON.parse(JSON.stringify(error, Object.getOwnPropertyNames(error))) : null
};
tasks.update(taskId, progress, () => process.exit(error ? 50 : 0));
tasks.setCompleted(taskId, progress, () => process.exit(error ? 50 : 0));
};
TASKS[task.type].apply(null, task.args.concat(progressCallback).concat(resultCallback));