exports.writer = util.inspect;
-function REPLServer(prompt, stream) {
+function REPLServer(prompt, stream, eval) {
var self = this;
- self.eval = function(code, context, file, cb) {
+ self.eval = eval || function(code, context, file, cb) {
try {
var err, result = vm.runInContext(code, context, file);
} catch (e) {
// prompt is a string to print on each line for the prompt,
// source is a stream to use for I/O, defaulting to stdin/stdout.
-exports.start = function(prompt, source) {
- var repl = new REPLServer(prompt, source);
+exports.start = function(prompt, source, eval) {
+ var repl = new REPLServer(prompt, source, eval);
if (!exports.repl) exports.repl = repl;
return repl;
};