-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LIPS command line (read-line (current-input-port))
erases prompt
#253
Comments
Thanks for the report, will try to check it out when I will have time. |
So the problem is because of the way stdin/stdout are created in REPL: var interp = Interpreter('repl', {
stdin: InputPort(function() {
return new Promise(function(resolve) {
rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question('', function(data) {
resolve(data);
rl.close();
});
});
}),
// -------------------------------------------------------------------------
stdout: OutputPort(function(x) {
if (typeof x !== 'string') {
x = this.get('repr')(x);
}
newline = !x.match(/\n$/);
process.stdout.write(x);
}), NodeJS |
the fix seems to work fine. It's available on devel branch. |
how do I |
nevermind, I figured it out. |
Best way is to use:
There is pending new release beta.17 on devel, I probably should release soon, but if you find some issues let me know, I will be able to fix them before the next release. |
Just released version 1.0.0-beta.17 with a fix. |
(read-line (current-input-port))
is the way I've seen to get a line of input form the user in Scheme. Unfortunately, on LIPS, this doesn't work quite-right, it just erases the prompt. (I'm looking for something equivalent to Python'sinput()
function.)It's supposed to wind up with "Enter a string: hello" on the first line after running test.scm. If you uncomment the (wait) call, you can see that the prompt is actually printed, but when it gets to the (read-line), the line is cleared.
If there is a better way of getting input, please let me know.
The text was updated successfully, but these errors were encountered: