Node: How to get the dirname where a script was called from?

Say I run a Node script from /foo/bar, though the script itself is located somewhere else (e.g. node_modules). Is there a way to get the working directory where the script was called from, i.e. /foo/bar?

I think what you want is process.cwd(): http://nodejs.org/api/process.html#process_process_cwd