Initial support for shebang.

There are some issues with loading modules from shebang-executed scripts
that will still need to be addressed, but this works for simple single
script situations.
pull/5370/head
Ryan 2009-08-03 18:39:37 +02:00
parent 11df252cb9
commit 6acac912dd
1 changed files with 3 additions and 0 deletions

View File

@ -81,6 +81,9 @@ node.Module.prototype.load = function (callback) {
self.target.__require = function (path) { return self.newChild(path, {}); };
self.target.__include = function (path) { self.newChild(path, self.target); };
// remove shebang
content = content.replace(/^\#\!.*/, '');
// create wrapper function
var wrapper = "function (__filename) { "+
" var onLoad; "+