66import act .cli .ascii_table .spec .IASCIITableAware ;
77import act .cli .util .CommandLineParser ;
88import act .util .ActContext ;
9+ import jline .Terminal2 ;
910import jline .console .ConsoleReader ;
1011import org .osgl .$ ;
1112import org .osgl .Osgl ;
1819import org .osgl .util .S ;
1920
2021import java .io .IOException ;
22+ import java .io .OutputStream ;
2123import java .io .PrintWriter ;
2224import java .io .Serializable ;
2325import java .util .List ;
@@ -34,6 +36,9 @@ public class CliContext extends ActContext.ActContextBase<CliContext> implements
3436
3537 private ConsoleReader console ;
3638
39+ // workaround of issue http://stackoverflow.com/questions/34467383/jline2-print-j-when-it-should-print-n-on-a-telnet-console
40+ private PrintWriter pw ;
41+
3742 private CommandLineParser parser ;
3843
3944 private IASCIITable asciiTable ;
@@ -59,6 +64,9 @@ public Object apply(String s, Serializable serializable) throws NotAppliedExcept
5964 };
6065 evaluatorCache = Osgl .T2 (getter , setter );
6166 this .console = $ .NPE (console );
67+ Terminal2 t2 = $ .cast (console .getTerminal ());
68+ t2 .setEchoEnabled (false );
69+ this .pw = new PrintWriter (console .getOutput ());
6270 }
6371
6472 public Osgl .T2 <? extends Osgl .Function <String , Serializable >, ? extends Osgl .Func2 <String , Serializable , ?>> evaluatorCache () {
@@ -87,22 +95,31 @@ public H.Format accept() {
8795 throw E .unsupport ();
8896 }
8997
90- public void print (String template , Object ... args ) {
98+ public void print0 (String template , Object ... args ) {
9199 try {
92100 console .print (S .fmt (template , args ));
93101 } catch (IOException e ) {
94102 throw E .ioException (e );
95103 }
96104 }
97105
98- public void println (String template , Object ... args ) {
106+ public void print (String template , Object ... args ) {
107+ pw .printf (template , args );
108+ }
109+
110+ public void println0 (String template , Object ... args ) {
99111 try {
100112 console .println (S .fmt (template , args ));
101113 } catch (IOException e ) {
102114 throw E .ioException (e );
103115 }
104116 }
105117
118+ public void println (String template , Object ... args ) {
119+ pw .printf (template , args );
120+ pw .println ();
121+ }
122+
106123 @ Override
107124 protected void releaseResources () {
108125 super .releaseResources ();
0 commit comments