Permalink
Browse files

allow util.inspect (or other writer) to return null or undefined to s…

…ignal no write (to bypass newline)
  • Loading branch information...
1 parent 698b1da commit a7fd3cef6611d315b3c9f6761e2ad0c436c4e815 @deanlandolt deanlandolt committed Apr 23, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/repl.js
View
@@ -170,7 +170,11 @@ function REPLServer(prompt, stream) {
if (ret !== undefined) {
self.context._ = ret;
- self.outputStream.write(exports.writer(ret) + '\n');
+ // allow custom writer to return null or undefined as a signal to not write
+ var str = exports.writer(ret);
+ if (str != null) {
+ self.outputStream.write(str + '\n');
+ }
}
self.bufferedCommand = '';

0 comments on commit a7fd3ce

Please sign in to comment.