Skip to content

Commit

Permalink
Merge pull request #64 from brokenmass/foreverpath-fix
Browse files Browse the repository at this point in the history
Allowing use of --foreverPath option even if forever is not globally installed
  • Loading branch information
arvind-agarwal authored Sep 18, 2017
2 parents 8d33e91 + 2ad88ec commit 89f9001
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions bin/forever-service
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,21 @@ platforms.get(function(err, platform){
if(options.logrotateDateExt) ctx.logrotateDateExt = 'dateext';
if(options.logrotateCompress) ctx.logrotateCompress = 'compress';
if(options.applyUlimits) ctx.applyUlimits = true;
ctx.foreverPath=path.dirname(getCmdPath('forever'));

if(options.foreverPath) {
var fp = options.foreverPath;
fp = fp.trim();

if(options.foreverPath){
var fp = options.foreverPath.trim();
if(!fp.match(/\/$/)) fp = fp+'/';
ctx.foreverPath = fp;
} else {
if(!ctx.foreverPath){
console.error("forever not found, forever must be installed using 'npm install -g forever'");
process.exit(1);
} else {
ctx.foreverPath+="/";
}
}
var foreverCmd = getCmdPath('forever');
if(foreverCmd){
ctx.foreverPath = path.dirname(foreverCmd) + "/";
} else {
console.error("forever not found, forever must be installed using 'npm install -g forever'");
process.exit(1);
}
}

if(options.runAsUser){
ctx.runAsUser = options.runAsUser;
Expand Down

0 comments on commit 89f9001

Please sign in to comment.