diff --git a/lib/cmds/blockchain/blockchain.js b/lib/cmds/blockchain/blockchain.js index 26af66229..e4da507d3 100644 --- a/lib/cmds/blockchain/blockchain.js +++ b/lib/cmds/blockchain/blockchain.js @@ -55,6 +55,20 @@ var Blockchain = function(options) { this.config.datadir = fs.embarkPath(".embark/development/datadir"); } + const spaceMessage = 'The path for %s in blockchain config contains spaces, please remove them'; + if (this.config.datadir.indexOf(' ') > 0) { + console.error(__(spaceMessage, 'datadir')); + process.exit(); + } + if (this.config.account.password.indexOf(' ') > 0) { + console.error(__(spaceMessage, 'account.password')); + process.exit(); + } + if (this.config.genesisBlock.indexOf(' ') > 0) { + console.error(__(spaceMessage, 'genesisBlock')); + process.exit(); + } + this.client = new options.client({config: this.config, env: this.env, isDev: this.isDev}); }; @@ -154,7 +168,7 @@ Blockchain.prototype.checkPathLength = function() { }; Blockchain.prototype.isClientInstalled = function(callback) { - let versionCmd = this.client.determineVersion(); + let versionCmd = this.client.determineVersionCommand(); this.runCommand(versionCmd, {}, (err, stdout, stderr) => { if (err || stderr || !stdout || stdout.indexOf("not found") >= 0) { return callback('Geth not found'); diff --git a/lib/cmds/blockchain/geth_commands.js b/lib/cmds/blockchain/geth_commands.js index 0c9924ff5..874e004eb 100644 --- a/lib/cmds/blockchain/geth_commands.js +++ b/lib/cmds/blockchain/geth_commands.js @@ -17,7 +17,7 @@ class GethCommands { cmd.push(this.determineNetworkType(config)); if (config.datadir) { - cmd.push("--datadir=" + config.datadir); + cmd.push(`--datadir=${config.datadir}`); } if (config.light) { @@ -29,7 +29,7 @@ class GethCommands { } if (config.account && config.account.password) { - cmd.push("--password=" + config.account.password); + cmd.push(`--password=${config.account.password}`); } if (Number.isInteger(config.verbosity) && config.verbosity >=0 && config.verbosity <= 5) { @@ -39,7 +39,7 @@ class GethCommands { return cmd; } - determineVersion() { + determineVersionCommand() { return this.geth_bin + " version"; } @@ -60,18 +60,18 @@ class GethCommands { let cmd = this.geth_bin + " " + this.commonOptions().join(' '); if (config.genesisBlock) { - cmd += "init \"" + config.genesisBlock + "\" "; + cmd += " init \"" + config.genesisBlock + "\" "; } return cmd; } newAccountCommand() { - return this.geth_bin + " " + this.commonOptions().join(' ') + "account new "; + return this.geth_bin + " " + this.commonOptions().join(' ') + " account new "; } listAccountsCommand() { - return this.geth_bin + " " + this.commonOptions().join(' ') + "account list "; + return this.geth_bin + " " + this.commonOptions().join(' ') + " account list "; } determineRpcOptions(config) { diff --git a/lib/i18n/locales/en.json b/lib/i18n/locales/en.json index 16d2aa460..8709bc977 100644 --- a/lib/i18n/locales/en.json +++ b/lib/i18n/locales/en.json @@ -139,6 +139,10 @@ "Storage process for ipfs ended before the end of this process. Code: 0": "Storage process for ipfs ended before the end of this process. Code: 0", "successfully uploaded to swarm": "successfully uploaded to swarm", "ipfs process started": "ipfs process started", + "no accounts found": "no accounts found", + "initializing genesis block": "initializing genesis block", + "The path for %s in blockchain config contains spaces, please remove them": "The path for %s in blockchain config contains spaces, please remove them", + "Blockchain process ended before the end of this process. Code: %s": "Blockchain process ended before the end of this process. Code: %s", "WARNING! DApp path length is too long: ": "WARNING! DApp path length is too long: ", "This is known to cause issues with starting geth, please consider reducing your DApp path's length to 66 characters or less.": "This is known to cause issues with starting geth, please consider reducing your DApp path's length to 66 characters or less.", "Installing packages...": "Installing packages...",