diff --git a/lib/cmds/blockchain/blockchain.js b/lib/cmds/blockchain/blockchain.js index f784a1278..38e364fbb 100644 --- a/lib/cmds/blockchain/blockchain.js +++ b/lib/cmds/blockchain/blockchain.js @@ -95,7 +95,6 @@ Blockchain.prototype.run = function() { }, function getMainCommand(next) { self.client.mainCommand(address, function(cmd) { - console.log(cmd); next(null, cmd); }); } @@ -136,14 +135,16 @@ Blockchain.prototype.isClientInstalled = function(callback) { Blockchain.prototype.initChainAndGetAddress = function(callback) { const self = this; - var address = null, result; + let address = null; // ensure datadir exists, bypassing the interactive liabilities prompt. self.datadir = '.embark/' + self.env + '/datadir'; async.waterfall([ function makeDir(next) { - fs.mkdirp(self.datadir, next); + fs.mkdirp(self.datadir, (err, _result) => { + next(err); + }); }, function copy(next) { // copy mining script @@ -154,11 +155,10 @@ Blockchain.prototype.initChainAndGetAddress = function(callback) { if (err || stderr || stdout === undefined || stdout.match(/{(\w+)}/) === null || stdout.indexOf("Fatal") >= 0) { console.log(__("no accounts found").green); return next(); - - } else { - console.log(__("already initialized").green); - address = result.output.match(/{(\w+)}/)[1]; } + console.log(__("already initialized").green); + address = stdout.match(/{(\w+)}/)[1]; + next(); }); }, function genesisBlock(next) { @@ -171,11 +171,12 @@ Blockchain.prototype.initChainAndGetAddress = function(callback) { }); }, function newAccount(next) { - result = self.runCommand(self.client.newAccountCommand(), {}, (err, stdout, _stderr) => { + self.runCommand(self.client.newAccountCommand(), {}, (err, stdout, _stderr) => { if (err) { return next(err); } address = stdout.match(/{(\w+)}/)[1]; + next(); }); } ], (err) => {