mirror of https://github.com/embarklabs/embark.git
add more error management to ipfs
This commit is contained in:
parent
d06a7f43ac
commit
4df669ab52
|
@ -33,7 +33,17 @@ class IPFSProcess extends ProcessWrapper {
|
|||
const self = this;
|
||||
const child = child_process.spawn('ipfs', ['daemon']);
|
||||
let lastMessage;
|
||||
|
||||
child.on('error', (err) => {
|
||||
err = err.toString();
|
||||
console.error('IPFS error: ', err);
|
||||
});
|
||||
child.stderr.on('data', (data) => {
|
||||
data = data.toString();
|
||||
console.log(`IPFS error: ${data}`);
|
||||
});
|
||||
child.stdout.on('data', (data) => {
|
||||
data = data.toString();
|
||||
if (!self.readyCalled && data.indexOf('Daemon is ready') > -1) {
|
||||
self.readyCalled = true;
|
||||
self.send({result: constants.storage.initiated});
|
||||
|
@ -44,7 +54,9 @@ class IPFSProcess extends ProcessWrapper {
|
|||
child.on('exit', (code) => {
|
||||
if (code) {
|
||||
console.error('IPFS exited with error code ' + code);
|
||||
console.error(lastMessage);
|
||||
if (lastMessage) {
|
||||
console.error(lastMessage);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue