Merge pull request #403 from sailxjx/bugfix/desc

fix crash in `pm2 desc id`
This commit is contained in:
Alexandre Strzelewicz 2014-04-15 22:34:22 +08:00
commit 7b5110c40d

View File

@ -8,6 +8,7 @@ var util = require('util');
var cronJob = require('cron').CronJob;
var cst = require('../constants.js');
var extItps = require('./interpreter.json');
var p = path;
/**
@ -35,6 +36,15 @@ Common.resolveAppPaths = function(app, cwd, outputter) {
app.env = app.env || {};
app.env.pm_cwd = cwd;
if (!app.exec_interpreter) {
if (extItps[path.extname(app.script)]) {
app.exec_interpreter = extItps[path.extname(app.script)];
app.exec_mode = 'fork_mode';
} else {
app.exec_interpreter = 'node';
}
};
if (!('exec_mode' in app)) app['exec_mode'] = 'cluster_mode';
app["pm_exec_path"] = path.resolve(cwd, app.script);
@ -44,7 +54,6 @@ Common.resolveAppPaths = function(app, cwd, outputter) {
app["name"] = p.basename(app["pm_exec_path"]);
}
if (fs.existsSync(app.pm_exec_path) == false) {
return new Error('script not found : ' + app.pm_exec_path);
}