From 52f088b966dad8a617f0cd3b41e833dcf111f992 Mon Sep 17 00:00:00 2001 From: elliottcable Date: Mon, 4 Jan 2010 23:00:41 -0900 Subject: [PATCH] Providing the option for a repl-printer other than sys.p --- lib/repl.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/repl.js b/lib/repl.js index 7b2c4d44d9..ee7dd9b61c 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -10,6 +10,8 @@ var scopeFunc = /^\s*function\s*([_\w\$]+)/; exports.scope = {}; exports.prompt = "node> "; +// Can overridden with custom print functions, such as `probe` or `eyes.js` +exports.writer = sys.p; exports.start = function (prompt) { if (prompt !== undefined) { exports.prompt = prompt; @@ -46,7 +48,7 @@ function readline (cmd) { var ret = eval(buffered_cmd); if (ret !== undefined) { exports.scope['_'] = ret; - sys.p(ret); + exports.writer(ret); } }