aboutsummaryrefslogtreecommitdiff
path: root/bqn.js
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-07-16 07:26:12 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-07-16 07:30:43 -0400
commit2914519108341ae4f28fc8a633929462a24ff244 (patch)
tree7ff4f16a4171664b9e9868630808514059c46e75 /bqn.js
parentb4dc8e155b3f10891d15143bb57b690d0456fc14 (diff)
Don't execute empty lines in the interactive REPL
Diffstat (limited to 'bqn.js')
-rwxr-xr-xbqn.js4
1 files changed, 3 insertions, 1 deletions
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));