Permalink
Browse files

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.
  • Loading branch information...
1 parent 11df252 commit 6acac912dd4da0479a0630a8d1b2878ca83b22de @ry ry committed Aug 3, 2009
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/node.js
View
@@ -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; "+

0 comments on commit 6acac91

Please sign in to comment.