From 52184ae3fbd62e3a1ca1661f5279b3c8308fcbd7 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Sun, 27 Feb 2011 21:20:51 -0600 Subject: [PATCH] forever.pidFilePath implementation --- lib/forever.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/forever.js b/lib/forever.js index 26b59ace..8a170f91 100644 --- a/lib/forever.js +++ b/lib/forever.js @@ -109,7 +109,7 @@ forever.start = function (script, options) { // forever.startDaemon = function (script, options) { options.logFile = forever.logFilePath(options.logFile); - options.pidFile = path.join(config.pidPath, options.pidFile); + options.pidFile = forever.pidFilePath(options.pidFile); var runner = new forever.Monitor(script, options); daemon.daemonize(options.logFile, options.pidFile, function (err, pid) { @@ -400,6 +400,19 @@ forever.logFilePath = function(logFile) { } }; +// +// ### function pidFilePath (pidFile) +// #### @logFile {string} Pid file path +// Determines the full pid file path name +// +forever.pidFilePath = function(pidFile) { + if (pidFile && pidFile[0] === "/") { + return pidFile; + } else { + return path.join(config.pidPath, pidFile); + } +}; + // // ### function checkProcess (pid, callback) // #### @pid {string} pid of the process to check