From 2914519108341ae4f28fc8a633929462a24ff244 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Fri, 16 Jul 2021 07:26:12 -0400 Subject: Don't execute empty lines in the interactive REPL --- bqn.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bqn.js b/bqn.js index f03c3c66..629a923c 100755 --- a/bqn.js +++ b/bqn.js @@ -147,7 +147,9 @@ if (!module.parent) { let e = exec(s=>show(repl(str(s)))); stdin.on('end', () => { process.exit(); }); stdin.on('readable', () => { - let inp; while ((inp=stdin.read())!==null) { e(inp.toString()); } + let inp; while ((inp=stdin.read())!==null) { + if (!/^[ \t]*[#\n]/.test(inp)) e(inp.toString()); + } }); } else if (arg0[0] !== '-' || (arg0==='-f'&&(arg0=(args=args.slice(1))[0],1))) { let f=arg0, a=list(args.slice(1).map(str)); -- cgit v1.2.3