From fb8eb8e34c55e5771bde6321f317c187048cc70b Mon Sep 17 00:00:00 2001 From: Joris Bontje Date: Wed, 29 Jul 2015 14:33:19 +0200 Subject: [PATCH] ensure datadir exists, bypassing the interactive liabilities prompt --- lib/blockchain.js | 10 +++++++++- package.json | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/blockchain.js b/lib/blockchain.js index d089ae1bf..12e4c548d 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 b3c5054e5..b3e436af6 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",