From 28c5b31e2db9241748a867fa69a8f215d696490f Mon Sep 17 00:00:00 2001 From: Utopiah Date: Fri, 12 May 2023 11:06:37 +0200 Subject: [PATCH] safer REPL --- index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 2b7d9f1..75cf8bd 100644 --- a/index.js +++ b/index.js @@ -398,9 +398,13 @@ function getCommand(){ if (command == "close") { rl.close(); } else { - console.log(command, eval(command) ) - getCommand() - // somehow switch to node REPL proper after?! + try { + console.log(command, eval(command) ) + } catch (err) { + console.log(err) + } + getCommand() + // somehow switch to node REPL proper after?! } }); }