From c6b555af4ee792f3d39a6a3adad870dcb384fb45 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 22 May 2018 11:07:58 -0400 Subject: [PATCH] use event for when engine is ready to deploy --- lib/index.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/index.js b/lib/index.js index 1b286df7..357a2a10 100644 --- a/lib/index.js +++ b/lib/index.js @@ -151,16 +151,17 @@ class Embark { engine.logger.info(__("Ready").underline); engine.events.emit("status", __("Ready").green); }); - - engine.deployManager.deployContracts(function (err) { - engine.startService("fileWatcher"); - if (options.runWebserver) { - engine.startService("webServer", { - host: options.serverHost, - port: options.serverPort - }); - } - callback(err); + engine.events.on('engine-ready', function () { + engine.deployManager.deployContracts(function (err) { + engine.startService("fileWatcher"); + if (options.runWebserver) { + engine.startService("webServer", { + host: options.serverHost, + port: options.serverPort + }); + } + callback(err); + }); }); } ], function (err, _result) {