Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

move execute_sjs out of closure

  • Loading branch information...
commit bc453046ec53134211d7be70c3d3dc2a3366a66e 1 parent fc006ba
Mark Hansen authored July 10, 2010

Showing 1 changed file with 17 additions and 16 deletions. Show diff stats Hide diff stats

  1. 33  lib/antinode.js
33  lib/antinode.js
@@ -192,22 +192,23 @@ function handle_request(path, req, resp) {
192 192
         finish(resp);
193 193
     }
194 194
 
195  
-    function execute_sjs() {
196  
-        fs.readFile(path, 'utf8', function(err, script) {
197  
-            try {
198  
-                if (err) throw err;
199  
-                var handler = {
200  
-                    log: log,
201  
-                    require: require
202  
-                };
203  
-                Script.runInNewContext(script, handler, path);
204  
-                handler.handle(req, resp);
205  
-            }
206  
-            catch (e) {
207  
-                server_error("Error executing server script "+path+": "+e);
208  
-            }
209  
-        });
210  
-    }
  195
+}
  196
+
  197
+function execute_sjs(path, req, resp) {
  198
+    fs.readFile(path, 'utf8', function(err, script) {
  199
+        try {
  200
+            if (err) throw err;
  201
+            var handler = {
  202
+                log: log,
  203
+                require: require
  204
+            };
  205
+            Script.runInNewContext(script, handler, path);
  206
+            handler.handle(req, resp);
  207
+        }
  208
+        catch (e) {
  209
+            server_error("Error executing server script "+path+": "+e);
  210
+        }
  211
+    });
211 212
 }
212 213
 
213 214
 function finish(resp) {	

0 notes on commit bc45304

Please sign in to comment.
Something went wrong with that request. Please try again.