
var pm2      = require('../../..');

var params = JSON.parse(process.env.fork_params);

console.log('Executing: pm2 %s %s', params.action, params.opts.args ? params.opts.args.join(' ') : '');

pm2.connect(function() {
  pm2.remoteV2(params.action, params.opts, function(err, dt) {
    process.send(JSON.stringify({err: err, dt: dt, isFinished : true}));
    pm2.disconnect(process.exit);
  });
});
