diff --git a/README.md b/README.md index df3ba7e5..e9dd854d 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ You can use forever to run any kind of script continuously (whether it is writte eg. forever start --uid "production" app.js forever stop production --sourceDir The source directory for which SCRIPT is relative to + --workingDir The working directory in which SCRIPT will execute --minUptime Minimum uptime (millis) for a script to not be considered "spinning" --spinSleepTime Time to wait (millis) between launches of a spinning script. --colors --no-colors will disable output coloring diff --git a/lib/forever/cli.js b/lib/forever/cli.js index c0935ee7..721b95d2 100644 --- a/lib/forever/cli.js +++ b/lib/forever/cli.js @@ -54,6 +54,7 @@ var help = [ ' eg. forever start --uid "production" app.js', ' forever stop production', ' --sourceDir The source directory for which SCRIPT is relative to', + ' --workingDir The working directory in which SCRIPT will execute', ' --minUptime Minimum uptime (millis) for a script to not be considered "spinning"', ' --spinSleepTime Time to wait (millis) between launches of a spinning script.', ' --colors --no-colors will disable output coloring', @@ -210,8 +211,8 @@ var getOptions = cli.getOptions = function (file) { [ 'pidFile', 'logFile', 'errFile', 'watch', 'minUptime', 'append', 'silent', 'outFile', 'max', 'command', 'path', 'spinSleepTime', - 'sourceDir', 'uid', 'watchDirectory', 'watchIgnore', 'killTree', 'killSignal', - 'id' + 'sourceDir', 'workingDir', 'uid', 'watchDirectory', 'watchIgnore', + 'killTree', 'killSignal', 'id' ].forEach(function (key) { options[key] = app.config.get(key); }); @@ -235,9 +236,8 @@ var getOptions = cli.getOptions = function (file) { } options.sourceDir = options.sourceDir || (file && file[0] !== '/' ? process.cwd() : '/'); - if (options.sourceDir) { - options.spawnWith = {cwd: options.sourceDir}; - } + options.workingDir = options.workingDir || options.sourceDir; + options.spawnWith = {cwd: options.workingDir}; return options; }