I've coded an node.js app that when get executed need to return CWD from process to be able to read files on disk.
When I start the app directly with node in the actual app directory...
#!sh
node app.js
everything is working fine and "process.cwd()" return the good path. But when the script is started with upstart or even directly with node from an other directory "process.cwd()" return "/" in the case of upstart and whatever directory from witch I directly start my app with node. So process.cwd() seem to output the directory from witch the command is executed. Why? What to do?
Node.js provides a global variable "__dirname" that provide the actual path of your application.