mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-17 09:46:37 +00:00
fix processes on ubuntu
This commit is contained in:
parent
fe34d84ff4
commit
138aaf39ff
@ -120,9 +120,9 @@ Blockchain.prototype.run = function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
args = _.compact(args);
|
args = _.compact(args);
|
||||||
const child = child_process.spawn(cmd, args, {cwd: process.cwd()});
|
self.child = child_process.spawn(cmd, args, {cwd: process.cwd()});
|
||||||
|
|
||||||
child.on('error', (err) => {
|
self.child.on('error', (err) => {
|
||||||
err = err.toString();
|
err = err.toString();
|
||||||
console.error('Blockchain error: ', err);
|
console.error('Blockchain error: ', err);
|
||||||
if (self.env === 'development' && err.indexOf('Failed to unlock') > 0) {
|
if (self.env === 'development' && err.indexOf('Failed to unlock') > 0) {
|
||||||
@ -131,19 +131,19 @@ Blockchain.prototype.run = function() {
|
|||||||
console.error(__('Otherwise, you can change your data directory in blockchain.json (datadir)').yellow);
|
console.error(__('Otherwise, you can change your data directory in blockchain.json (datadir)').yellow);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
child.stdout.on('data', (data) => {
|
self.child.stdout.on('data', (data) => {
|
||||||
console.log(`Geth error: ${data}`);
|
console.log(`Geth error: ${data}`);
|
||||||
});
|
});
|
||||||
// Geth logs appear in stderr somehow
|
// Geth logs appear in stderr somehow
|
||||||
child.stderr.on('data', (data) => {
|
self.child.stderr.on('data', (data) => {
|
||||||
data = data.toString();
|
data = data.toString();
|
||||||
if (self.onReadyCallback && !self.readyCalled && data.indexOf('Mapped network port') > -1) {
|
if (self.onReadyCallback && !self.readyCalled && data.indexOf('WebSocket endpoint opened') > -1) {
|
||||||
self.readyCalled = true;
|
self.readyCalled = true;
|
||||||
self.onReadyCallback();
|
self.onReadyCallback();
|
||||||
}
|
}
|
||||||
console.log('Geth: ' + data);
|
console.log('Geth: ' + data);
|
||||||
});
|
});
|
||||||
child.on('exit', (code) => {
|
self.child.on('exit', (code) => {
|
||||||
if (code) {
|
if (code) {
|
||||||
console.error('Geth exited with error code ' + code);
|
console.error('Geth exited with error code ' + code);
|
||||||
}
|
}
|
||||||
@ -151,6 +151,12 @@ Blockchain.prototype.run = function() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Blockchain.prototype.kill = function() {
|
||||||
|
if (this.child) {
|
||||||
|
this.child.kill();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Blockchain.prototype.checkPathLength = function() {
|
Blockchain.prototype.checkPathLength = function() {
|
||||||
let dappPath = fs.dappPath('');
|
let dappPath = fs.dappPath('');
|
||||||
if (dappPath.length > 66) {
|
if (dappPath.length > 66) {
|
||||||
|
@ -30,9 +30,16 @@ class BlockchainProcess extends ProcessWrapper {
|
|||||||
blockchainReady() {
|
blockchainReady() {
|
||||||
blockchainProcess.send({result: constants.blockchain.blockchainReady});
|
blockchainProcess.send({result: constants.blockchain.blockchainReady});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kill() {
|
||||||
|
this.blockchain.kill();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
process.on('message', (msg) => {
|
process.on('message', (msg) => {
|
||||||
|
if (msg === 'exit') {
|
||||||
|
return blockchainProcess.kill();
|
||||||
|
}
|
||||||
if (msg.action === constants.blockchain.init) {
|
if (msg.action === constants.blockchain.init) {
|
||||||
blockchainProcess = new BlockchainProcess(msg.options);
|
blockchainProcess = new BlockchainProcess(msg.options);
|
||||||
return blockchainProcess.send({result: constants.blockchain.initiated});
|
return blockchainProcess.send({result: constants.blockchain.initiated});
|
||||||
|
@ -330,6 +330,7 @@ class Dashboard {
|
|||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
this.input.key(["C-c"], function () {
|
this.input.key(["C-c"], function () {
|
||||||
|
self.events.emit('exit');
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -43,6 +43,10 @@ class BlockchainProcessLauncher {
|
|||||||
this.logger.info(__('Blockchain node is ready').cyan);
|
this.logger.info(__('Blockchain node is ready').cyan);
|
||||||
this.events.emit(constants.blockchain.blockchainReady);
|
this.events.emit(constants.blockchain.blockchainReady);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.events.on('exit', () => {
|
||||||
|
this.blockchainProcess.send('exit');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,17 +31,17 @@ class IPFSProcess extends ProcessWrapper {
|
|||||||
|
|
||||||
startIPFSDaemon() {
|
startIPFSDaemon() {
|
||||||
const self = this;
|
const self = this;
|
||||||
const child = child_process.spawn('ipfs', ['daemon']);
|
this.child = child_process.spawn('ipfs', ['daemon']);
|
||||||
|
|
||||||
child.on('error', (err) => {
|
this.child.on('error', (err) => {
|
||||||
err = err.toString();
|
err = err.toString();
|
||||||
console.error('IPFS error: ', err);
|
console.error('IPFS error: ', err);
|
||||||
});
|
});
|
||||||
child.stderr.on('data', (data) => {
|
this.child.stderr.on('data', (data) => {
|
||||||
data = data.toString();
|
data = data.toString();
|
||||||
console.log(`IPFS error: ${data}`);
|
console.log(`IPFS error: ${data}`);
|
||||||
});
|
});
|
||||||
child.stdout.on('data', (data) => {
|
this.child.stdout.on('data', (data) => {
|
||||||
data = data.toString();
|
data = data.toString();
|
||||||
if (!self.readyCalled && data.indexOf('Daemon is ready') > -1) {
|
if (!self.readyCalled && data.indexOf('Daemon is ready') > -1) {
|
||||||
self.readyCalled = true;
|
self.readyCalled = true;
|
||||||
@ -49,15 +49,24 @@ class IPFSProcess extends ProcessWrapper {
|
|||||||
}
|
}
|
||||||
console.log('IPFS: ' + data);
|
console.log('IPFS: ' + data);
|
||||||
});
|
});
|
||||||
child.on('exit', (code) => {
|
this.child.on('exit', (code) => {
|
||||||
if (code) {
|
if (code) {
|
||||||
console.error('IPFS exited with error code ' + code);
|
console.error('IPFS exited with error code ' + code);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kill() {
|
||||||
|
if (this.child) {
|
||||||
|
this.child.kill();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
process.on('message', (msg) => {
|
process.on('message', (msg) => {
|
||||||
|
if (msg === 'exit') {
|
||||||
|
return ipfsProcess.kill();
|
||||||
|
}
|
||||||
if (msg.action === constants.storage.init) {
|
if (msg.action === constants.storage.init) {
|
||||||
ipfsProcess = new IPFSProcess(msg.options);
|
ipfsProcess = new IPFSProcess(msg.options);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,12 @@ class StorageProcessesLauncher {
|
|||||||
this.storageConfig = options.storageConfig;
|
this.storageConfig = options.storageConfig;
|
||||||
this.webServerConfig = options.webServerConfig;
|
this.webServerConfig = options.webServerConfig;
|
||||||
this.processes = {};
|
this.processes = {};
|
||||||
|
|
||||||
|
this.events.on('exit', () => {
|
||||||
|
Object.keys(this.processes).forEach(processName => {
|
||||||
|
this.processes[processName].send('exit');
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
processExited(storageName, code) {
|
processExited(storageName, code) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user