Skip to content

Commit

Permalink
fix REPL #253
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Nov 22, 2023
1 parent a527834 commit 3108c73
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![npm](https://img.shields.io/badge/npm-1.0.0%E2%80%93beta.16-blue.svg)](https://www.npmjs.com/package/@jcubic/lips)
![1.0.0 Complete](https://img.shields.io/github/milestones/progress-percent/jcubic/lips/1?label=1.0.0%20Complete)
[![Build and test](https://github.com/jcubic/lips/actions/workflows/build.yaml/badge.svg?branch=devel&event=push)](https://github.com/jcubic/lips/actions/workflows/build.yaml)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&61cb7f36a3668cabc9125f4c4bce1141)](https://coveralls.io/github/jcubic/lips?branch=devel)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&1eb2cfbcb9a646f24938a31ec46bbc33)](https://coveralls.io/github/jcubic/lips?branch=devel)
[![Join Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jcubic/lips)
![NPM Download Count](https://img.shields.io/npm/dm/@jcubic/lips)
![JSDelivr Download count](https://img.shields.io/jsdelivr/npm/hm/@jcubic/lips)
Expand Down
6 changes: 4 additions & 2 deletions bin/lips.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,15 @@ const moduleURL = new URL(import.meta.url);
const __dirname = path.dirname(moduleURL.pathname);
const __filename = path.basename(moduleURL.pathname);
const command_line = [];
var interp = Interpreter('repl', {
let last_line = '';
const interp = Interpreter('repl', {
stdin: InputPort(function() {
return new Promise(function(resolve) {
rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question('', function(data) {
rl.question(last_line, function(data) {
resolve(data);
rl.close();
});
Expand All @@ -222,6 +223,7 @@ var interp = Interpreter('repl', {
x = this.get('repr')(x);
}
newline = !x.match(/\n$/);
last_line = x.split('\n').pop();
process.stdout.write(x);
}),
// -------------------------------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions dist/lips.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3108c73

Please sign in to comment.