Browse Source

experimental pm2 kill code

ca333-dev
Satinder Grewal 8 years ago
parent
commit
0382b361bd
  1. 14
      main.js
  2. 8
      routes/shepherd.js

14
main.js

@ -14,6 +14,7 @@ const exec = require('child_process').exec;
var fs = require('fs');
var fs = require('fs-extra')
var mkdirp = require('mkdirp');
var pm2 = require('pm2');
// preload.js
const _setImmediate = setImmediate
@ -159,6 +160,19 @@ function createWindow (status) {
// if window closed we kill iguana proc
mainWindow.on('closed', function () {
pm2.connect(function(err) { //start up pm2 god
if (err) {
console.error(err);
process.exit(2);
}
pm2.killDaemon(function(err) {
pm2.disconnect(); // Disconnect from PM2
if (err) throw err
});
});
//if (os.platform() !== 'win32') { ig.kill(); /*corsproxy_process.kill();*/ }
/*if (os.platform() === 'win32') {
//exec('TASKKILL /F /IM iguana.exe /T', {cwd: iguanaDir});

8
routes/shepherd.js

@ -135,12 +135,8 @@ function slayer(flock) {
console.log(flock);
pm2.delete('IGUANA', function(err, ret) {
should(err).be.null()
pm2.list(function(err, ret) {
should(err).be.null()
ret.length.should.eql(8);
done();
});
//console.log(err);
console.log(ret);
});
}

Loading…
Cancel
Save