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

Forever does not like absolute paths #84

Closed
justmoon opened this issue Jul 7, 2011 · 9 comments · May be fixed by chasenlehara/forever#1, piranna/forever#9, chasenlehara/forever#4 or piranna/forever#14
Closed

Comments

@justmoon
Copy link

justmoon commented Jul 7, 2011

First off, with relative paths, everything is fine and dandy:

moon@clymene:/atlas/www/node-bitcoin-p2p$ forever start daemon/start.js
info: Running action: start
info: Forever processing file: daemon/start.js
moon@clymene:/atlas/www/node-bitcoin-p2p$ forever restart daemon/start.js
info: Running action: restart
info: Forever processing file: daemon/start.js
info: Forever restarted processes:
  [0] node daemon/start.js [2652, 2650] /home/moon/.forever/VhGx.log 0:0:0:5.471
moon@clymene:/atlas/www/node-bitcoin-p2p$ forever stop daemon/start.js
info: Running action: stop
info: Forever processing file: daemon/start.js
info: Forever stopped process:
  [0] node daemon/start.js [2679, 2678] /home/moon/.forever/VhGx.log 0:0:0:4.325

But if we use an absolute path, no such luck:

moon@clymene:/atlas/www/node-bitcoin-p2p$ forever start /atlas/www/node-bitcoin-p2p/daemon/start.js
info: Running action: start
info: Forever processing file: /atlas/www/node-bitcoin-p2p/daemon/start.js
moon@clymene:/atlas/www/node-bitcoin-p2p$ forever restart /atlas/www/node-bitcoin-p2p/daemon/start.js
info: Running action: restart
info: Forever processing file: /atlas/www/node-bitcoin-p2p/daemon/start.js

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
TypeError: Cannot read property 'sourceDir' of undefined
    at /usr/local/lib/node_modules/forever/lib/forever.js:235:21
    at /usr/local/lib/node_modules/forever/node_modules/async/lib/async.js:97:13
    at Array.forEach (native)
    at /usr/local/lib/node_modules/forever/node_modules/async/lib/async.js:26:24
    at Object.forEach (/usr/local/lib/node_modules/forever/node_modules/async/lib/async.js:96:9)
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/forever/lib/forever.js:225:13)
    at EventEmitter.emit (events.js:64:17)
    at Array.<anonymous> (/usr/local/lib/node_modules/forever/lib/forever.js:200:15)
    at EventEmitter._tickCallback (node.js:126:26)
moon@clymene:/atlas/www/node-bitcoin-p2p$ forever stop /atlas/www/node-bitcoin-p2p/daemon/start.js
info: Running action: stop
info: Forever processing file: /atlas/www/node-bitcoin-p2p/daemon/start.js

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
TypeError: Cannot read property 'command' of undefined
    at /usr/local/lib/node_modules/forever/lib/forever.js:345:26
    at Array.forEach (native)
    at Object.list (/usr/local/lib/node_modules/forever/lib/forever.js:344:11)
    at Array.<anonymous> (/usr/local/lib/node_modules/forever/lib/forever.js:200:45)
    at EventEmitter._tickCallback (node.js:126:26)
@indexzero
Copy link
Member

Thanks. I'll investigate this tonight.

@justmoon
Copy link
Author

justmoon commented Jul 7, 2011

Awesome, thanks!!! :)

@bmeck
Copy link
Contributor

bmeck commented Jul 8, 2011

This is because of how path.join works:

> path.join('/x/','/tmp/')
'/x/tmp/'

Could check that the file exists before it tries a join?

> path.existsSync('/tmp/')
true

@justmoon
Copy link
Author

justmoon commented Jul 8, 2011

Any reason why you're not using path.resolve()? Seems to me it was made for exactly this purpose.

@3rd-Eden
Copy link
Contributor

I believe my pull request would fix this: https://github.com/indexzero/forever/pull/85

Because you have the number 2 in your path.

@indexzero
Copy link
Member

@3rd-Eden Thanks I will merge that in tonight

@indexzero
Copy link
Member

@justmoon have you tried to reproduce this in forever@0.6.1? I think @3rd-Eden was right about the cause being the number, not the absolute path. I'm going to close this bug now.

@justmoon
Copy link
Author

Yep, works, thanks! :)

@caomu
Copy link

caomu commented Sep 18, 2014

the problem is still not fixed in the current version!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment