From 36ae882a2669af2d7540fd6f6680804a11a8467b Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Thu, 26 Jul 2018 16:56:50 +0100 Subject: [PATCH] Add dedicated writer for string result --- lib/dashboard/repl.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/dashboard/repl.js b/lib/dashboard/repl.js index 8f23b586..bd5442fc 100644 --- a/lib/dashboard/repl.js +++ b/lib/dashboard/repl.js @@ -1,4 +1,5 @@ const repl = require("repl"); +const util = require("util"); const Console = require('./console.js'); @@ -20,11 +21,20 @@ class REPL { }); } + enhancedWriter(output) { + if ((typeof output) === "string") { + return output; + } else { + return util.inspect(output, {colors: true}); + } + } + start(done) { this.replServer = repl.start({ prompt: "Embark (" + this.env + ") > ", useGlobal: true, - eval: this.enhancedEval.bind(this) + eval: this.enhancedEval.bind(this), + writer: this.enhancedWriter.bind(this) }); this.replServer.on("exit", () => {