Skip to content

Commit

Permalink
forever.logFilePath utility. Treat paths that start with / as paths r…
Browse files Browse the repository at this point in the history
…elative to the root, not the forever root.
  • Loading branch information
kpdecker committed Feb 27, 2011
1 parent 8e323ca commit e9b2cd3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bin/forever
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ function tryStart (callback) {
options.uid = uid;
options.pidFile = 'forever' + uid + '.pid';
options.logFile = argv.l || 'forever' + uid + '.log';
fullLog = path.join(forever.config.root, options.logFile);

fullLog = forever.logFilePath(options.logFile);
fullScript = path.join(options.sourceDir, file);

forever.stat(fullLog, fullScript, function (err) {
Expand Down
15 changes: 14 additions & 1 deletion lib/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ forever.start = function (script, options) {
// Starts a script with forever as a daemon
//
forever.startDaemon = function (script, options) {
options.logFile = path.join(config.root, options.logFile || 'forever.log');
options.logFile = forever.logFilePath(options.logFile);
options.pidFile = path.join(config.pidPath, options.pidFile);
var runner = new forever.Monitor(script, options);

Expand Down Expand Up @@ -387,6 +387,19 @@ forever.randomString = function (bits) {
return ret;
};

//
// ### function logFilePath (logFile)
// #### @logFile {string} Log file path
// Determines the full logfile path name
//
forever.logFilePath = function(logFile) {
if (logFile && logFile[0] === "/") {
return logFile;
} else {
return path.join(forever.config.root, logFile || "forever.log");
}
};

//
// ### function checkProcess (pid, callback)
// #### @pid {string} pid of the process to check
Expand Down

0 comments on commit e9b2cd3

Please sign in to comment.