change ipfs to spawn too

This commit is contained in:
Jonathan Rainville 2018-05-28 12:49:44 -04:00
parent 6fa472ae11
commit 3c32f98f71
3 changed files with 8 additions and 11 deletions

View File

@ -6,7 +6,7 @@ const fs = require('../../core/fs.js');
const GethCommands = require('./geth_commands.js'); const GethCommands = require('./geth_commands.js');
/*eslint complexity: ["error", 35]*/ /*eslint complexity: ["error", 36]*/
var Blockchain = function(options) { var Blockchain = function(options) {
this.blockchainConfig = options.blockchainConfig; this.blockchainConfig = options.blockchainConfig;
this.env = options.env || 'development'; this.env = options.env || 'development';

View File

@ -139,5 +139,8 @@
"For more info go to http://embark.status.im": "For more info go to http://embark.status.im", "For more info go to http://embark.status.im": "For more info go to http://embark.status.im",
"%s is not installed on your machine": "%s is not installed on your machine", "%s is not installed on your machine": "%s is not installed on your machine",
"You can install it by visiting: %s": "You can install it by visiting: %s", "You can install it by visiting: %s": "You can install it by visiting: %s",
"IPFS node is offline": "IPFS node is offline" "IPFS node is offline": "IPFS node is offline",
"Starting ipfs process": "Starting ipfs process",
"ipfs process started": "ipfs process started",
"IPFS node detected": "IPFS node detected"
} }

View File

@ -1,4 +1,4 @@
const shelljs = require('shelljs'); const child_process = require('child_process');
const ProcessWrapper = require('../../process/processWrapper'); const ProcessWrapper = require('../../process/processWrapper');
const constants = require('../../constants'); const constants = require('../../constants');
@ -13,7 +13,7 @@ class IPFSProcess extends ProcessWrapper {
} }
checkIPFSVersion() { checkIPFSVersion() {
shelljs.exec('ipfs --version', {silent: true}, (err, stdout, _stderr) => { child_process.exec('ipfs --version', {silent: true}, (err, stdout, _stderr) => {
if (err) { if (err) {
console.error(err); console.error(err);
return; return;
@ -31,13 +31,7 @@ class IPFSProcess extends ProcessWrapper {
startIPFSDaemon() { startIPFSDaemon() {
const self = this; const self = this;
const child = shelljs.exec('ipfs daemon', {silent: true}, (err, _stdout, _stderr) => { const child = child_process.spawn('ipfs', ['daemon']);
if (err) {
console.error(err);
process.exit(1);
}
process.exit();
});
let lastMessage; let lastMessage;
child.stdout.on('data', (data) => { child.stdout.on('data', (data) => {
if (!self.readyCalled && data.indexOf('Daemon is ready') > -1) { if (!self.readyCalled && data.indexOf('Daemon is ready') > -1) {