diff --git a/lib/blockchain.js b/lib/blockchain.js index d089ae1b..12e4c548 100644 --- a/lib/blockchain.js +++ b/lib/blockchain.js @@ -1,3 +1,4 @@ +var mkdirp = require('mkdirp'); Blockchain = function(blockchainConfig) { this.config = blockchainConfig; @@ -73,6 +74,14 @@ Blockchain.prototype.get_address = function() { var address = null; if (config.account.init) { + // ensure datadir exists, bypassing the interactive liabilities prompt. + var newDir = mkdirp.sync(config.datadir); + if (newDir) { + console.log("=== datadir created"); + } else { + console.log("=== datadir already exists"); + } + console.log("running: " + this.list_command()); result = exec(this.list_command()); @@ -96,4 +105,3 @@ Blockchain.prototype.startChain = function(use_tmp) { } module.exports = Blockchain - diff --git a/package.json b/package.json index b3c5054e..b3e436af 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "jasmine": "^2.3.1", "meteor-build-client": "^0.1.6", "methodmissing": "^0.0.3", + "mkdirp": "^0.5.1", "python": "^0.0.4", "read-yaml": "^1.0.0", "shelljs": "^0.5.0",