From c6abafff0542ad4bb20a739ad949558aa1a7eabb Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 23 Aug 2018 13:38:58 -0400 Subject: [PATCH] fix printing --- lib/core/modules/coderunner/codeRunner.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/core/modules/coderunner/codeRunner.js b/lib/core/modules/coderunner/codeRunner.js index 14484c86b..fc308beac 100644 --- a/lib/core/modules/coderunner/codeRunner.js +++ b/lib/core/modules/coderunner/codeRunner.js @@ -49,12 +49,14 @@ class CodeRunner { end--; // Remove the `;` because we add function calls } code = code.substring(5, end); // remove await keyword - code += '.then(console.log).catch(console.error);'; // Add promise catch } else { code = `(async function() {${code}})();`; } } let result = RunCode.doEval(code); + if (result instanceof Promise) { + return result.then((value) => cb(null, value)).catch(cb); + } if (forConsoleOnly && self.ipc.isServer()) { self.commands.push({code}); self.ipc.broadcast("runcode:newCommand", {code});