mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
21 lines
550 B
JavaScript
21 lines
550 B
JavaScript
// Inject custom modules
|
|
if (process.env.pmx === "true") {
|
|
require('pmx').init({
|
|
http: false
|
|
});
|
|
}
|
|
|
|
// Rename the process
|
|
process.title = 'node ' + process.env.pm_exec_path;
|
|
|
|
// Require the real application
|
|
if (process.env.pm_exec_path)
|
|
require('module')._load(process.env.pm_exec_path, null, true);
|
|
else
|
|
throw new Error('Could not _load() the script');
|
|
|
|
// Hack some values to make node think that the user's application
|
|
// was started directly such as `node app.js`
|
|
process.mainModule.loaded = false;
|
|
require.main = process.mainModule;
|