Skip to content

Conversation

axvr
Copy link
Contributor

@axvr axvr commented Jun 4, 2020

Edit: I have signed the Clojure contributor license agreement, but I've just realised that the Clojure docs say to create a Jira ticket and upload a patch to it instead of creating a pull request; does ClojureCLR follow the same workflow? I'm happy to do that if you'd prefer.

While experimenting with the .NET Core port of ClojureCLR, I noticed that on Linux (and likely also macOS), the REPL was unable to handle backspacing or the use of the cursor/arrow keys.

Here is a screencast of the bug.

Screencast from 05-06-20 10 19 34

After some experimentation, I found that the issue was with the implementation of *in*. I managed to fix it by replacing Console.In with Console.OpenStandardInput(). (I also updated the other two "standard streams" so that they all work the same way.)

I have tested these changes on both Fedora Linux 32 and Microsoft Windows 10 with .NET Core 3.1. According to the Microsoft Docs I linked above this change will work on all .NET Framework, .NET Standard and .NET Core versions.

(Note: this pull request is set to merge to the newframework branch, as I believe this is only a bug on .NET Core.)

If you would like me to make any changes to this pull request, I'm happy to do them, or if you want to make the changes yourself instead of merging this, that's fine with me too.

P.S. Thanks so much for all your work on this port, I'm really excited for the official .NET Core release of ClojureCLR (no matter how slow start-up has to be).

@axvr axvr changed the title Fix handling of "standard input" on Unix-like operating systems Fix behaviour of "standard input" on Unix-like operating systems Jun 5, 2020
@dmiller
Copy link
Member

dmiller commented Jun 9, 2020 via email

Previously the ClojureCLR `*in*` (standard input) stream wouldn't behave
correctly on Unix-like operating systems such as macOS and Linux.  When
used to accept user input, it would incorrectly handle backspacing and
the use of the cursor/arrow keys.

As ClojureCLR's REPL reads from `*in*` it too was affected by this bug.

This bug also prevented the REPL from being able to work with other
command line tools such as `rlwrap`.

Switching from `Console.In` to `Console.OpenStandardInput` resolved the
issue.

This commit also updates the other standard streams (standard error and
standard output) so that they all work the same way.
@dmiller dmiller merged commit b26b1c1 into clojure:newframework Oct 17, 2020
@axvr axvr deleted the standard-io-fix branch October 11, 2021 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants