add id to solc process to avoid multiple callback calls

This commit is contained in:
Jonathan Rainville 2018-05-31 13:32:02 -04:00
parent a8507998d9
commit 0ab151500d
5 changed files with 13 additions and 11 deletions

View File

@ -51,7 +51,7 @@ process.on('message', function (msg) {
if (msg.action === 'compile') {
solcProcess.compile(msg.jsonObj, (output) => {
process.send({result: "compilation", output: output});
process.send({result: "compilation-" + msg.id, output: output});
});
}
});

View File

@ -2,6 +2,7 @@ let utils = require('../../utils/utils.js');
let fs = require('../../core/fs.js');
let currentSolcVersion = require('../../../package.json').dependencies.solc;
const ProcessLauncher = require('../../process/processLauncher');
const uuid = require('uuid/v1');
class SolcW {
@ -49,11 +50,12 @@ class SolcW {
}
compile(jsonObj, done) {
this.solcProcess.once('result', 'compilation', (msg) => {
const id = uuid();
this.solcProcess.once('result', 'compilation-' + id, (msg) => {
done(JSON.parse(msg.output));
});
this.solcProcess.send({action: 'compile', jsonObj: jsonObj});
this.solcProcess.send({action: 'compile', jsonObj: jsonObj, id});
}
}

View File

@ -53,7 +53,7 @@ module.exports = {
// TODO: this global here might not be necessary at all
global.web3 = global.embark.web3;
mocha.suite.beforeAll('Wait for deploy', (done) => {
mocha.suite.beforeEach('Wait for deploy', (done) => {
test.onReady(() => {
done();
});

View File

@ -11,7 +11,7 @@ class TestLogger {
logFunction() {
this.logs.push(arguments);
console.log(...arguments);
// console.log(...arguments);
}
contractsState() {

12
package-lock.json generated
View File

@ -50,7 +50,7 @@
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.2.tgz",
"integrity": "sha512-Q3FWsbdmkQd1ib11A4XNWQvRD//5KpPoGawA8aB2DR7pWKoW9XQv3+dGxD/Z1eVFze23Okdo27ZQytVFlweKvQ==",
"requires": {
"@types/node": "10.1.2"
"@types/node": "10.1.4"
}
},
"@types/lockfile": {
@ -59,16 +59,16 @@
"integrity": "sha512-pD6JuijPmrfi84qF3/TzGQ7zi0QIX+d7ZdetD6jUA6cp+IsCzAquXZfi5viesew+pfpOTIdAVKuh1SHA7KeKzg=="
},
"@types/node": {
"version": "10.1.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.1.2.tgz",
"integrity": "sha512-bjk1RIeZBCe/WukrFToIVegOf91Pebr8cXYBwLBIsfiGWVQ+ifwWsT59H3RxrWzWrzd1l/Amk1/ioY5Fq3/bpA=="
"version": "10.1.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.1.4.tgz",
"integrity": "sha512-GpQxofkdlHYxjHad98UUdNoMO7JrmzQZoAaghtNg14Gwg7YkohcrCoJEcEMSgllx4VIZ+mYw7ZHjfaeIagP/rg=="
},
"@types/node-fetch": {
"version": "1.6.9",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-1.6.9.tgz",
"integrity": "sha512-n2r6WLoY7+uuPT7pnEtKJCmPUGyJ+cbyBR8Avnu4+m1nzz7DwBVuyIvvlBzCZ/nrpC7rIgb3D6pNavL7rFEa9g==",
"requires": {
"@types/node": "10.1.2"
"@types/node": "10.1.4"
}
},
"@types/semver": {
@ -81,7 +81,7 @@
"resolved": "https://registry.npmjs.org/@types/tar/-/tar-4.0.0.tgz",
"integrity": "sha512-YybbEHNngcHlIWVCYsoj7Oo1JU9JqONuAlt1LlTH/lmL8BMhbzdFUgReY87a05rY1j8mfK47Del+TCkaLAXwLw==",
"requires": {
"@types/node": "10.1.2"
"@types/node": "10.1.4"
}
},
"@types/url-join": {