Created
February 2, 2011 10:06
-
-
Save dominictarr/807491 to your computer and use it in GitHub Desktop.
module.main bug in node-v0.3.7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("process.version = " + process.version ) | |
console.log("module = ") | |
console.log(module) | |
console.log("process.mainModule = ") | |
console.log(process.mainModule) | |
console.log("require.main = ") | |
console.log(require.main) | |
console.log("require.main == module ? ",require.main == module) | |
console.log("process.argv[1] == __filename ? ",process.argv[1] == __filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nvm use v0.3.6 | |
node module.main.js | |
nvm use v0.3.7 | |
node module.main.js | |
#which will produce the following... | |
: <<'output' | |
Now using node v0.3.6 | |
process.version = v0.3.6 | |
module = | |
{ id: '.', | |
exports: {}, | |
parent: undefined, | |
filename: '/home/dominic/dev/examples/module.main.js', | |
loaded: false, | |
exited: false, | |
children: [] } | |
process.mainModule = | |
{ id: '.', | |
exports: {}, | |
parent: undefined, | |
filename: '/home/dominic/dev/examples/module.main.js', | |
loaded: false, | |
exited: false, | |
children: [] } | |
require.main = | |
{ id: '.', | |
exports: {}, | |
parent: undefined, | |
filename: '/home/dominic/dev/examples/module.main.js', | |
loaded: false, | |
exited: false, | |
children: [] } | |
require.main == module ? true | |
process.argv[1] == __filename ? true | |
Now using node v0.3.7 | |
process.version = v0.3.7 | |
module = | |
{ id: '/home/dominic/dev/examples/module.main.js', | |
exports: {}, | |
parent: undefined, | |
filename: '/home/dominic/dev/examples/module.main.js', | |
loaded: false, | |
exited: false, | |
children: [] } | |
process.mainModule = | |
{ id: '.', | |
exports: {}, | |
parent: undefined, | |
filename: null, | |
loaded: false, | |
exited: false, | |
children: [] } | |
require.main = | |
{ id: '.', | |
exports: {}, | |
parent: undefined, | |
filename: null, | |
loaded: false, | |
exited: false, | |
children: [] } | |
require.main == module ? false | |
process.argv[1] == __filename ? true | |
output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment