Skip to content

Commit

Permalink
Potential Bug fix for forever exited with code 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvind Agarwal authored and Arvind Agarwal committed Aug 25, 2015
1 parent f10ec1f commit 00cad99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions bin/forever-service
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,9 @@ function getForeverRoot(user){

function getCmdPath(cmd){
var r=shell.exec('whereis '+cmd, {silent: true});
var re = new RegExp(cmd+":","g");
if(r.output) {
var p = r.output.replace(re, "").trim();
//console.log(cmd + 'path is ' + p);
return p;
var rs = r.output && r.output.split(" ");
if(rs && rs.length && rs.length > 1) {
return rs[1];

This comment has been minimized.

Copy link
@houmark

houmark Aug 25, 2015

Not sure if the forever could be installed more than twice, but if you want the last install path, then it might be better to do rs[rs.length-1] instead of rs[1] — it seems safe in any case anyways?

} else {
console.log(cmd + 'path not found');
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "forever-service",
"version": "0.5.3",
"version": "0.5.4",
"preferGlobal": "true",
"description": "Provision node script as a service via forever, allowing it to automatically start on boot, working across various Linux distros and OS",
"main": "lib/api.js",
Expand Down

0 comments on commit 00cad99

Please sign in to comment.