Merge pull request #231 from sc-forks/tree-kill

Kill testrpc w/ tree-kill
pull/232/head
c-g-e-w-e-k-e- 7 years ago committed by GitHub
commit 3a501566e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 37
      lib/app.js
  2. 5
      package-lock.json
  3. 1
      package.json

@ -5,6 +5,7 @@ const childprocess = require('child_process');
const readline = require('readline');
const reqCwd = require('req-cwd');
const istanbul = require('istanbul');
const treeKill = require('tree-kill');
const getInstrumentedVersion = require('./instrumentSolidity.js');
const CoverageMap = require('./coverageMap.js');
const defaultTruffleConfig = require('./truffleConfig.js');
@ -424,25 +425,33 @@ class App {
* @param {String} err error message
*/
cleanUp(err) {
this.log('Cleaning up...');
const self = this;
function exit(err){
if (err) {
self.log(`${err}\nExiting without generating coverage...`);
process.exit(1);
} else if (self.testsErrored) {
self.log('Some truffle tests failed while running coverage');
process.exit(1);
} else {
self.log('Done.');
process.exit(0);
}
}
self.log('Cleaning up...');
shell.config.silent = true;
shell.rm('-Rf', this.coverageDir);
shell.rm('-Rf', self.coverageDir);
shell.rm('./allFiredEvents');
shell.rm('./scTopics');
if (this.testrpcProcess) {
this.testrpcProcess.stdout.destroy();
this.testrpcProcess.stderr.destroy();
this.testrpcProcess.kill();
}
if (err) {
this.log(`${err}\nExiting without generating coverage...`);
process.exit(1);
} else if (this.testsErrored) {
this.log('Some truffle tests failed while running coverage');
process.exit(1);
if (self.testrpcProcess) {
treeKill(self.testrpcProcess.pid, function(killError){
self.log(`Shutting down testrpc-sc (pid ${self.testrpcProcess.pid})`)
exit(err)
});
} else {
process.exit(0);
exit(err);
}
}
}

5
package-lock.json generated

@ -5714,6 +5714,11 @@
"punycode": "1.4.1"
}
},
"tree-kill": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.0.tgz",
"integrity": "sha512-DlX6dR0lOIRDFxI0mjL9IYg6OTncLm/Zt+JiBhE5OlFcAR8yc9S7FFXU9so0oda47frdM/JFsk7UjNt9vscKcg=="
},
"trim-right": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz",

@ -29,6 +29,7 @@
"shelljs": "^0.7.4",
"sol-explore": "^1.6.2",
"solidity-parser-sc": "0.4.8",
"tree-kill": "^1.2.0",
"web3": "^0.18.4"
},
"devDependencies": {

Loading…
Cancel
Save