Skip to content

Commit

Permalink
Add --workingDir option to specify the CWD of the process in which SC…
Browse files Browse the repository at this point in the history
…RIPT is run
  • Loading branch information
mykwillis authored and indexzero committed Nov 4, 2014
1 parent cb72aed commit 84cf5ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions lib/forever/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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);
});
Expand All @@ -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;
}
Expand Down

0 comments on commit 84cf5ad

Please sign in to comment.