@@ -204,6 +204,7 @@ Blockchain.prototype.isClientInstalled = function(callback) {
204204Blockchain . prototype . initChainAndGetAddress = function ( callback ) {
205205 const self = this ;
206206 let address = null ;
207+ const ALREADY_INITIALIZED = 'already' ;
207208
208209 // ensure datadir exists, bypassing the interactive liabilities prompt.
209210 self . datadir = '.embark/' + self . env + '/datadir' ;
@@ -219,14 +220,14 @@ Blockchain.prototype.initChainAndGetAddress = function(callback) {
219220 fs . copy ( fs . embarkPath ( "js" ) , ".embark/" + self . env + "/js" , { overwrite : true } , next ) ;
220221 } ,
221222 function listAccounts ( next ) {
222- self . runCommand ( self . client . listAccountsCommand ( ) , { } , ( err , stdout , stderr ) => {
223- if ( err || stderr || stdout === undefined || stdout . match ( / { ( \w + ) } / ) === null || stdout . indexOf ( "Fatal" ) >= 0 ) {
223+ self . runCommand ( self . client . listAccountsCommand ( ) , { } , ( err , stdout , _stderr ) => {
224+ if ( err || stdout === undefined || stdout . match ( / { ( \w + ) } / ) === null || stdout . indexOf ( "Fatal" ) >= 0 ) {
224225 console . log ( __ ( "no accounts found" ) . green ) ;
225226 return next ( ) ;
226227 }
227228 console . log ( __ ( "already initialized" ) . green ) ;
228229 address = stdout . match ( / { ( \w + ) } / ) [ 1 ] ;
229- next ( ) ;
230+ next ( ALREADY_INITIALIZED ) ;
230231 } ) ;
231232 } ,
232233 function genesisBlock ( next ) {
@@ -248,6 +249,9 @@ Blockchain.prototype.initChainAndGetAddress = function(callback) {
248249 } ) ;
249250 }
250251 ] , ( err ) => {
252+ if ( err === ALREADY_INITIALIZED ) {
253+ err = null ;
254+ }
251255 callback ( err , address ) ;
252256 } ) ;
253257} ;
0 commit comments