Skip to content

Commit

Permalink
Give REPL clients access to the global context, and limit stacktraces…
Browse files Browse the repository at this point in the history
… to where the repl call ends
  • Loading branch information
Michael Olson committed Mar 17, 2013
1 parent 92d8f9b commit b563749
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions swank-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,16 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

var EventEmitter = require("events").EventEmitter;
var Script = require('vm').Script;
var evalcx = Script.runInContext;
var vm = require('vm'), Script = vm.Script;
function evalcx(code, context, filename) {
try {
return vm.runInThisContext(code, filename);

This comment has been minimized.

Copy link
@ivan4th

ivan4th Jun 10, 2013

Member

The context argument is ignored here, and now one can't use _swank.output() or require() in REPL (node v0.10.10). Why not use vm.runInContext? (or maybe we should make it an option?)

} catch (err) {
var regex = new RegExp('(at ' + filename + ':.*)[\\s\\S]*');
err.stack = err.stack.replace(regex, '$1');
throw err;
}
};
var util = require("util");
var url = require("url");
var assert = require("assert");
Expand Down

0 comments on commit b563749

Please sign in to comment.