ensure datadir exists, bypassing the interactive liabilities prompt

This commit is contained in:
Joris Bontje 2015-07-29 14:33:19 +02:00
parent 2bd14e5c6c
commit fb8eb8e34c
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,4 @@
var mkdirp = require('mkdirp');
Blockchain = function(blockchainConfig) { Blockchain = function(blockchainConfig) {
this.config = blockchainConfig; this.config = blockchainConfig;
@ -73,6 +74,14 @@ Blockchain.prototype.get_address = function() {
var address = null; var address = null;
if (config.account.init) { 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()); console.log("running: " + this.list_command());
result = exec(this.list_command()); result = exec(this.list_command());
@ -96,4 +105,3 @@ Blockchain.prototype.startChain = function(use_tmp) {
} }
module.exports = Blockchain module.exports = Blockchain

View File

@ -19,6 +19,7 @@
"jasmine": "^2.3.1", "jasmine": "^2.3.1",
"meteor-build-client": "^0.1.6", "meteor-build-client": "^0.1.6",
"methodmissing": "^0.0.3", "methodmissing": "^0.0.3",
"mkdirp": "^0.5.1",
"python": "^0.0.4", "python": "^0.0.4",
"read-yaml": "^1.0.0", "read-yaml": "^1.0.0",
"shelljs": "^0.5.0", "shelljs": "^0.5.0",