bump fixes

This commit is contained in:
tknew2 2014-06-12 14:29:32 +02:00
parent 2aa81cadcf
commit 0e918f67c6
13 changed files with 39 additions and 29 deletions

View File

@ -1,7 +1,7 @@
var axm = require('axm');
axm.action('refresh:db', function(reply) {
axm.action('refresh:db', {comment : 'Refresh main database'}, function(reply) {
console.log('Refreshing');
reply({success : true});
});

View File

@ -1,8 +1,8 @@
var axm = require('axm');
setInterval(function() {
process.send({type:"user:register", msg: {
user : 'ayayayywqeqweqwea !',
email : 'ouiiii@asdad.fr'
}});
//process.send('heysaaa');
}, 3000);
axm.emit('content:page:created', {
msg : 'A CMS page has been created',
user : 'Francois Debiole'
});
}, 1000);

View File

@ -45,7 +45,8 @@ Common.resolveAppPaths = function(app, cwd, outputter) {
if (!app.exec_interpreter) {
if (extItps[path.extname(app.script)]) {
app.exec_interpreter = extItps[path.extname(app.script)];
app.exec_mode = 'fork_mode';
if (extItps[path.extname(app.script)] != 'node')
app.exec_mode = 'fork_mode';
} else {
app.exec_interpreter = 'node';
}

View File

@ -174,6 +174,8 @@ God.executeApp = function(env, cb) {
God.clusters_db[env_copy.pm_id] = clu;
clu.once('error', function(err) {
clu.pm2_env.status = cst.ERRORED_STATUS;
});

View File

@ -480,11 +480,9 @@ module.exports = function(God) {
return cb(God.logAndGenerateError(id + ' id unknown'), {});
var proc = God.clusters_db[id];
var action_exist = false;
proc.pm2_env.axm_actions.forEach(function(action) {
console.log(action, opts.msg);
if (action.action_name == opts.msg)
action_exist = true;
});

View File

@ -62,16 +62,15 @@ module.exports = function(God) {
}
startLogging(function() {
try {
var cspr = spawn(command, args, {
env : pm2_env,
cwd : pm2_env.pm_cwd || process.cwd(),
detached : true,
cwd : pm2_env.pm_cwd || process.cwd(),
stdio : ['ipc', null, null]
});
} catch(e) {
console.error(cb, e);
console.error(e.stack || e);
if (cb) return cb(e);
}
@ -81,7 +80,9 @@ module.exports = function(God) {
cspr.pm2_env.status = cst.ONLINE_STATUS;
cspr.stderr.on('data', function(data) {
stderr.write(data);
God.bus.emit('log:err', {
process : cspr,
data : data

View File

@ -88,6 +88,7 @@ var ReverseInteract = {
else
msg = decipherMessage(raw_msg);
ipm2a.rpc.msgProcess({
id : msg.process_id,
msg : msg.action_name

View File

@ -115,13 +115,13 @@
"chokidar": "^0.8.2",
"json-stringify-safe" : "^5.0.0",
"pidusage" : "^0.0.5",
"nssocket" : "^0.5.1"
"nssocket" : "^0.5.1",
"axm" : "^0.1.2"
},
"devDependencies": {
"mocha": "^1.20.1",
"should": "^4.0.0",
"better-assert": "^1.0.0",
"axm" : "^0.1.2"
"better-assert": "^1.0.0"
},
"bugs" : {
"url" : "https://github.com/Unitech/pm2/issues"

0
test/fixtures/events/custom_action.js vendored Normal file → Executable file
View File

0
test/fixtures/events/custom_action_with_params.js vendored Normal file → Executable file
View File

View File

@ -5,11 +5,10 @@ var APPS = {};
APPS.forkPM2 = function() {
var pm2 = require('child_process').fork('lib/Satan.js', [], {
detached : true
env : process.env
});
pm2.unref();
return pm2;
}
};
APPS.launchApp = function(ipm2, script, name, cb) {
ipm2.rpc.prepare({
@ -17,20 +16,20 @@ APPS.launchApp = function(ipm2, script, name, cb) {
pm_err_log_path : path.resolve(process.cwd(), 'test/' + name + 'err.log'),
pm_out_log_path : path.resolve(process.cwd(), 'test/' + name + '.log'),
pm_pid_path : path.resolve(process.cwd(), 'test/child'),
exec_mode : 'cluster',
exec_mode : 'cluster_mode',
name : name
}, cb);
}
};
APPS.launchAppFork = function(ipm2, script, name, cb) {
ipm2.rpc.prepare({
pm_exec_path : path.resolve(process.cwd(), 'test/fixtures/' + script),
pm_err_log_path : path.resolve(process.cwd(), 'test/errLog.log'),
pm_out_log_path : path.resolve(process.cwd(), 'test/outLog.log'),
pm_err_log_path : path.resolve(process.cwd(), 'test/errLogasdasd.log'),
pm_out_log_path : path.resolve(process.cwd(), 'test/outLogasdasd.log'),
pm_pid_path : path.resolve(process.cwd(), 'test/child'),
exec_mode : 'fork',
exec_mode : 'fork_mode',
name : name
}, cb);
}
};
module.exports = APPS;

View File

@ -126,14 +126,22 @@ describe('Interactor', function() {
APPS.launchApp(ipm2, 'events/custom_action.js', 'custom_action', function(err, proc) {
cur_id = proc[1].pm2_env.pm_id;
should(err).be.null;
setTimeout(done, 500);
setTimeout(function() {
ipm2.rpc.getMonitorData({}, function(err, procs) {
should(err).be.null;
console.log(procs);
procs.length.should.eql(2);
procs[1].pm2_env.restart_time.should.eql(0);
done();
});
}, 1000);
});
});
it('should get information about instance', function(done) {
socket.send('ask');
socket.data('ask:rep', function (data) {

View File

@ -260,7 +260,7 @@ describe('PM2 BUS / RPC', function() {
});
});
describe('Specific event in FORK_MODE', function() {
describe.skip('Specific event in FORK_MODE', function() {
beforeEach(function(done) {
ipm2 = Ipm2();
@ -394,7 +394,7 @@ describe('PM2 BUS / RPC', function() {
});
describe('Multiple axm_actions test', function() {
describe.skip('Multiple axm_actions test', function() {
beforeEach(function(done) {
ipm2 = Ipm2();