Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build #807

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/forever/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ var getOptions = cli.getOptions = function (file) {
].join(' '));
}

function assignSpawnWith(options) {
function setDefaults(options) {
options = clone(options)
options.sourceDir = options.sourceDir || (file && file[0] !== '/' ? process.cwd() : '/');
options.workingDir = options.workingDir || options.sourceDir;
options.spawnWith = { cwd: options.workingDir };
Expand All @@ -285,11 +286,12 @@ var getOptions = cli.getOptions = function (file) {

if (configs && configs.length) {
return configs.map(function (conf) {
return assignSpawnWith(objectAssign(clone(options), conf));
var startupConfig = setDefaults(objectAssign(clone(options), conf));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why this is correct btw - this gives config values higher priority than cli flags. Surely this should be reversed?

return startupConfig;
});
}

return [assignSpawnWith(options)];
return [setDefaults(options)];
};

//
Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/servers.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
"uid": "server1",
"append": true,
"script": "server.js",
"sourceDir": "./test/fixtures"
"sourceDir": "./test/fixtures",
"workingDir": "./"
},
{
"uid": "server2",
"append": true,
"script": "server.js",
"sourceDir": "./test/fixtures",
"workingDir": "./",
"args": ["-p", 8081]
}
]