fix so child process doesn't hang some cmds

This commit is contained in:
Iuri Matias 2017-02-25 22:39:40 -05:00
parent 85519e95d8
commit 5fc2d97609
3 changed files with 10 additions and 4 deletions

View File

@ -12,3 +12,7 @@ process.on('message', function(msg) {
}
});
process.on('exit', function() {
process.exit(0);
});

View File

@ -1,4 +1,4 @@
var solcProcess = require('child_process').fork(__dirname + '/solcP.js');
var solcProcess;
var compilerLoaded = false;
var SolcW = function() {
@ -6,6 +6,7 @@ var SolcW = function() {
SolcW.prototype.load_compiler = function(done) {
if (compilerLoaded) { done(); }
solcProcess = require('child_process').fork(__dirname + '/solcP.js');
solcProcess.once('message', function(msg) {
if (msg.result !== 'loadedCompiler') {
return;
@ -18,7 +19,7 @@ SolcW.prototype.load_compiler = function(done) {
SolcW.prototype.isCompilerLoaded = function() {
return (compilerLoaded === true);
}
};
SolcW.prototype.compile = function(obj, optimize, done) {
solcProcess.once('message', function(msg) {

View File

@ -238,13 +238,14 @@ var Embark = {
pipeline.build(abi);
callback();
}
], function(err, result) {
if (err) {
self.logger.error(err.message);
} else {
self.logger.trace("finished".underline);
self.logger.info("finished building".underline);
}
// needed due to child processes
process.exit();
});
},