nodejitsu/forever — pull request #627 by mykwillis (2014-11-02 15:55:51+00:00)
Title: Add --workingDir option to specify the CWD of the process in which SCRIP...

...T is run

This change introduces a new command line option, --workingDir, which can be used to explicitly set the working directory for the process in which the executed script is run. When --workingDir is not specified, all existing behavior remains unchanged.

Notes:

In the existing codebase, the current working directory for a launched process will be set to '/' if the script is specified with a leading '/' (i.e., absolute path).

The current working directory for a launched process can be influenced by setting --sourceDir. This is undocumented/potentially unexpected behavior, as the documented purpose of --sourceDir is to specify the root directory relative to which the given script path is interpreted, and makes no mention of changing the working directory.

Because the only existing way to change the working directory is to use --sourceDir, and because it is not supported to use absolute script paths when specifying --sourceDir, it is confusing and cumbersome to specify a working directory for a script when using absolute paths.

This change preserves all existing behavior if --workingDir is not specified. If --workingDir is specified, its value is used as the CWD for the script process.

More background here:
https://github.com/nodejitsu/forever/issues/270#issuecomment-61410733

Appears related to these issues:
https://github.com/nodejitsu/forever/issues/270
https://github.com/nodejitsu/forever/issues/84