always show process messages if error and catch geth errors

This commit is contained in:
Jonathan Rainville 2018-05-23 10:51:42 -04:00
parent 4815555a89
commit 1bca31184e
3 changed files with 16 additions and 5 deletions

View File

@ -112,12 +112,20 @@ Blockchain.prototype.run = function() {
});
if (self.onReadyCallback) {
// Geth logs appear in stderr somehow
let lastMessage;
child.stderr.on('data', (data) => {
if (!self.readyCalled && data.indexOf('Mapped network port') > -1) {
self.readyCalled = true;
return self.onReadyCallback();
self.onReadyCallback();
}
lastMessage = data;
console.log('Geth: ' + data);
});
child.on('exit', (code) => {
if (code) {
console.error('Geth exited with error code ' + 1);
console.error(lastMessage);
}
console.log('Geth:' + data);
});
}
});

View File

@ -36,11 +36,15 @@ class ProcessLauncher {
}
self._checkSubscriptions(msg);
});
this.process.on('exit', (code) => {
self.logger.info('Process exited with code ' + code);
});
}
// Translates logs from the child process to the logger
_handleLog(msg) {
if (this.silent) {
if (this.silent && msg.type !== 'error') {
return;
}
if (this.logger[msg.type]) {

View File

@ -20,8 +20,7 @@ class BlockchainProcessLauncher {
logger: this.logger,
events: this.events,
normalizeInput: this.normalizeInput,
//silent: true
silent: false
silent: true
});
this.blockchainProcess.send({
action: constants.blockchain.init, options: {