jline / jline3

JLine is a Java library for handling console input.
Other
1.49k stars 218 forks source link

Does not work with IDEA console or gradle console #32

Closed altavir closed 8 years ago

altavir commented 8 years ago

Throws

org.jline.reader.EndOfFileException: org.jline.utils.ClosedException: InputStreamReader is closed.
        at org.jline.keymap.BindingReader.readCharacter(BindingReader.java:135)
        at org.jline.keymap.BindingReader.readBinding(BindingReader.java:68)
        at org.jline.keymap.BindingReader.readBinding(BindingReader.java:60)
        at org.jline.reader.impl.LineReaderImpl.readBinding(LineReaderImpl.java:675)
        at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:511)
        at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:392)

on LineReader::readLine

altavir commented 8 years ago

Jna and janst terminals also do not work with different exceptions. Jansi:

    at org.fusesource.jansi.WindowsAnsiOutputStream.getConsoleInfo(WindowsAnsiOutputStream.java:105)
    at org.fusesource.jansi.WindowsAnsiOutputStream.<init>(WindowsAnsiOutputStream.java:98)
    at org.jline.terminal.impl.jansi.JansiWinSysTerminal.<init>(JansiWinSysTerminal.java:32)
    at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:146)
    at org.jline.terminal.TerminalBuilder.build(TerminalBuilder.java:109)
    at hep.dataforge.grind.GrindShell.withTerminal(GrindShell.groovy:72)
    at hep.dataforge.grind.GrindShell$withTerminal.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
    at hep.dataforge.grind.RunGrindShell.run(RunGrindShell.groovy:11)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
    at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:923)
    at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:906)
    at org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:410)
    at org.codehaus.groovy.runtime.InvokerHelper$runScript.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
    at hep.dataforge.grind.RunGrindShell.main(RunGrindShell.groovy)

Jna:

java.lang.NullPointerException
    at org.jline.utils.Log.render(Log.java:50)
    at org.jline.utils.Log.log(Log.java:78)
    at org.jline.utils.Log.debug(Log.java:31)
    at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:180)
    at org.jline.terminal.TerminalBuilder.build(TerminalBuilder.java:109)
gnodet commented 8 years ago

The behavior on windows is different from the one on unix plaftorms and imho they should be similar, so I'll fix this. On unix, when the terminal is not a real terminal (such as in IDEA), a DumbTerminal is created. It'd be better to detect a dumb terminal on windows and create the terminal accordingly.