Fix calculation of rootDir now that commands are executed directly (fixes #158)

Note: `process.mainModule` is an undocumented, internal API in node.js; if there was a particular reason to use it, better speak up and document it now!