فهرست منبع

allow execution of async code when running sequential tasks

Gildas 7 سال پیش
والد
کامیت
3f7e3d32e8
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      lib/single-file/single-file-core.js

+ 3 - 1
lib/single-file/single-file-core.js

@@ -197,17 +197,19 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			if (DEBUG) {
 				log("**** STARTED STAGE", step, "****");
 			}
+			const sequentialPromises = [];
 			STAGES[step].sequential.forEach(task => {
 				let startTime;
 				if (DEBUG) {
 					startTime = Date.now();
 					log("  -- STARTED task =", task.action);
 				}
-				this.executeTask(task);
+				sequentialPromises.push(this.executeTask(task));
 				if (DEBUG) {
 					log("  -- ENDED   task =", task.action, "delay =", Date.now() - startTime);
 				}
 			});
+			await Promise.all(sequentialPromises);
 			if (STAGES[step].parallel) {
 				return await Promise.all(STAGES[step].parallel.map(task => {
 					let startTime;