Permalink
Browse files

move execute_sjs out of closure

  • Loading branch information...
1 parent fc006ba commit bc453046ec53134211d7be70c3d3dc2a3366a66e @mhansen committed Jul 10, 2010
Showing with 17 additions and 16 deletions.
  1. +17 −16 lib/antinode.js
View
@@ -192,22 +192,23 @@ function handle_request(path, req, resp) {
finish(resp);
}
- function execute_sjs() {
- fs.readFile(path, 'utf8', function(err, script) {
- try {
- if (err) throw err;
- var handler = {
- log: log,
- require: require
- };
- Script.runInNewContext(script, handler, path);
- handler.handle(req, resp);
- }
- catch (e) {
- server_error("Error executing server script "+path+": "+e);
- }
- });
- }
+}
+
+function execute_sjs(path, req, resp) {
+ fs.readFile(path, 'utf8', function(err, script) {
+ try {
+ if (err) throw err;
+ var handler = {
+ log: log,
+ require: require
+ };
+ Script.runInNewContext(script, handler, path);
+ handler.handle(req, resp);
+ }
+ catch (e) {
+ server_error("Error executing server script "+path+": "+e);
+ }
+ });
}
function finish(resp) {

0 comments on commit bc45304

Please sign in to comment.