Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Initial support for shebang.
Browse files Browse the repository at this point in the history
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
ry committed Aug 3, 2009
1 parent 11df252 commit 6acac91
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/node.js
Expand Up @@ -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; "+
Expand Down

0 comments on commit 6acac91

Please sign in to comment.