little fixes

This commit is contained in:
Jonathan Rainville 2018-05-28 16:02:44 -04:00
parent 729c43bae1
commit a7bc9755c3
3 changed files with 3 additions and 18 deletions

View File

@ -124,33 +124,28 @@ Blockchain.prototype.run = function() {
child.on('error', (err) => {
err = err.toString();
console.error('ERROR', err);
console.error('Blockchain error: ', err);
if (self.env === 'development' && err.indexOf('Failed to unlock') > 0) {
console.error('\n' + __('Development blockchain has changed to use the --dev option.').yellow);
console.error(__('You can reset your workspace to fix the problem with').yellow + ' embark reset'.cyan);
console.error(__('Otherwise, you can change your data directory in blockchain.json (datadir)').yellow);
}
});
// Geth logs appear in stderr somehow
let lastMessage;
child.stdout.on('data', (data) => {
console.log(`Geth error: ${data}`);
});
// Geth logs appear in stderr somehow
child.stderr.on('data', (data) => {
data = data.toString();
if (self.onReadyCallback && !self.readyCalled && data.indexOf('Mapped network port') > -1) {
self.readyCalled = true;
self.onReadyCallback();
}
lastMessage = data;
console.log('Geth: ' + data);
});
child.on('exit', (code) => {
if (code) {
console.error('Geth exited with error code ' + code);
if (lastMessage) {
console.error(lastMessage);
}
}
});
});

View File

@ -32,7 +32,6 @@ class IPFSProcess extends ProcessWrapper {
startIPFSDaemon() {
const self = this;
const child = child_process.spawn('ipfs', ['daemon']);
let lastMessage;
child.on('error', (err) => {
err = err.toString();
@ -48,15 +47,11 @@ class IPFSProcess extends ProcessWrapper {
self.readyCalled = true;
self.send({result: constants.storage.initiated});
}
lastMessage = data;
console.log('IPFS: ' + data);
});
child.on('exit', (code) => {
if (code) {
console.error('IPFS exited with error code ' + code);
if (lastMessage) {
console.error(lastMessage);
}
}
});
}

View File

@ -34,27 +34,22 @@ class SwarmProcess extends ProcessWrapper {
err = err.toString();
console.error('Swarm error: ', err);
});
let lastMessage;
child.stdout.on('data', (data) => {
data = data.toString();
console.log(`Swarm error: ${data}`);
});
// Geth logs appear in stderr somehow
// Swarm logs appear in stderr somehow
child.stderr.on('data', (data) => {
data = data.toString();
if (!self.readyCalled && data.indexOf('Swarm http proxy started') > -1) {
self.readyCalled = true;
self.send({result: constants.storage.initiated});
}
lastMessage = data;
console.log('Swarm: ' + data);
});
child.on('exit', (code) => {
if (code) {
console.error('Swarm exited with error code ' + code);
if (lastMessage) {
console.error(lastMessage);
}
}
});
}