I am using JLine 2 (v2.13) in conjunction with a Socket IO to create an admin console for my app which can be accessed via an ordinary telnet client. However I found it prints out strange symbols when it should print out a line break:
act.app.restart restart app^Jact.job.list List jobs
The correct output should be:
act.app.restart restart app
act.job.list List jobs
I traced into the code and found the following line of code that caused the trouble:
Another weird thing is when I press the up arrow to get the history, the console prints out ^[[A
and nothing else happens.
Does anyone have any idea?
Update: added relevant source code
- The code accepting the incoming telnet connection:
- The code that creates the
ConsoleReader
and dispatches the command:
Update 2
Sorry I've disappeared for a while. Just come back as my project gives me a breath of fresh air. So here is what happened: I've created a PrintWriter
and use it as a workaround for the ^J
issue:
However there are many other issues when jline2
is used along with telnet session:
- Type
<TAB>
displays tab instead of activate complete list. However after I hit enter key it gives me a complete list plus an error message: - Type
<UP>
arrow, displays^[[A
, hit enter key it will execute my last command. However I lost the command line editing
The issue is still there and I believe there should be a way to solve it just need some guide...