mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
This commit is contained in:
parent
c6e2a4e387
commit
33ba35dc88
4
examples/cwd.js
Normal file
4
examples/cwd.js
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
console.log(process.env.PWD);
|
||||
console.log(process.cwd());
|
||||
console.log(__dirname);
|
||||
@ -5,11 +5,12 @@
|
||||
var fs = require('fs');
|
||||
var p = require('path');
|
||||
var cst = require('../constants');
|
||||
var worker = require('cluster').worker;
|
||||
|
||||
require('coffee-script');
|
||||
|
||||
(function ProcessContainer() {
|
||||
var fs = require('fs');
|
||||
var worker = require('cluster').worker;
|
||||
|
||||
var outFile = process.env.pm_out_log_path;
|
||||
var errFile = process.env.pm_err_log_path;
|
||||
@ -23,10 +24,10 @@ require('coffee-script');
|
||||
var cronRestart = process.env.cron_restart;
|
||||
|
||||
fs.writeFileSync(pidFile, process.pid);
|
||||
process.on('exit', function () {
|
||||
fs.unlinkSync(pidFile);
|
||||
});
|
||||
|
||||
// process.on('exit', function () {
|
||||
// fs.unlinkSync(pidFile);
|
||||
// });
|
||||
|
||||
// Add args to process if args specified on start
|
||||
if (process.env.args != null)
|
||||
process.argv = process.argv.concat(eval(process.env.args));
|
||||
@ -58,7 +59,7 @@ function cronize(cron_pattern) {
|
||||
|
||||
function exec(script, outFile, errFile) {
|
||||
// Change dir to fix process.cwd
|
||||
//process.chdir(p.dirname(script));
|
||||
process.chdir(process.env.PWD);
|
||||
|
||||
var stderr, stdout;
|
||||
|
||||
@ -81,10 +82,11 @@ function exec(script, outFile, errFile) {
|
||||
};
|
||||
})(process.stdout.write);
|
||||
|
||||
process.on('uncaughtException', function(err) {
|
||||
stderr.write(err.stack);
|
||||
process.exit(1);
|
||||
});
|
||||
// process.on('uncaughtException', function(err) {
|
||||
// stderr.write(err.stack);
|
||||
// process.exit(1);
|
||||
// });
|
||||
|
||||
|
||||
// Get the script & exec
|
||||
require(script);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "pm2",
|
||||
"preferGlobal": "true",
|
||||
"version": "0.5.8",
|
||||
"version": "0.5.9",
|
||||
"engines" : {
|
||||
"node" : ">=0.8"
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user