Skip to content
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

JLine creates dumb terminal since 3.19 and autocompletion doesn't work #856

Closed
turbanoff opened this issue Aug 9, 2023 · 0 comments
Closed
Milestone

Comments

@turbanoff
Copy link
Contributor

Recently I've upgraded jline dependency to v.3.23 in my project and noticed that autocompletion doesn't work anymore.
Got warning from jLine:

WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)

I've tracked down issue to this #PR - #616
For some reason jLine don't consider output stream as a system stream and fallbacks to dumb terminal

Output from org.jline.terminal.impl.Diag:

java.lang.NoClassDefFoundError: com/sun/jna/Platform
        at org.jline.terminal.impl.jna.JnaNativePty.current(JnaNativePty.java:41)
        at org.jline.terminal.impl.jna.JnaTerminalProvider.current(JnaTerminalProvider.java:33)
        at org.jline.terminal.impl.jna.JnaTerminalProvider.posixSysTerminal(JnaTerminalProvider.java:84)
        at org.jline.terminal.impl.jna.JnaTerminalProvider.sysTerminal(JnaTerminalProvider.java:55)
        at org.jline.terminal.impl.Diag.testProvider(Diag.java:99)
        at org.jline.terminal.impl.Diag.diag(Diag.java:57)
        at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:557)
        at org.jline.terminal.TerminalBuilder.build(TerminalBuilder.java:314)
        at org.jline.terminal.TerminalBuilder.terminal(TerminalBuilder.java:106)
        at com.CoreLauncher.main(CoreLauncher.java:62)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Platform
        ... 24 more
System properties
=================
os.name =         Linux
OSTYPE =          null
MSYSTEM =         null
PWD =             /opt/ctdev
ConEmuPID =       null
WSL_DISTRO_NAME = null
WSL_INTEROP =     null

OSUtils
=================
IS_WINDOWS = false
IS_CYGWIN =  false
IS_MSYSTEM = false
IS_WSL =     false
IS_WSL1 =    false
IS_WSL2 =    false
IS_CONEMU =  false
IS_OSX =     false

JnaSupport
=================
StdIn stream =    false
StdOut stream =   false
StdErr stream =   false
Unable to check stream names: java.lang.NoClassDefFoundError: com/sun/jna/Platform
Unable to open terminal: java.lang.NoClassDefFoundError: com/sun/jna/Platform

JansiSupport
=================
StdIn stream =    true
StdOut stream =   false
StdErr stream =   false
StdIn stream name =     /dev/pts/1
StdOut stream name =    null
StdErr stream name =    null
Terminal size: Size[cols=200, rows=34]
The terminal seems to work: terminal org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jansi.linux.LinuxNativePty

Exec Support
=================
StdIn stream =    true
StdOut stream =   false
StdErr stream =   false
StdIn stream name =     /dev/pts/1
StdOut stream name =    null
StdErr stream name =    null
Terminal size: Size[cols=200, rows=34]

Application is executed via python/bash scripts. Output is also copied to file via tee command

  |   |                           `-python3 /opt/ctdev/system/libexec/dx_module.py -c run -d console
  |   |                               `-bash /opt/ctdev/system/libexec/start_app console
  |   |                                   |-bash /opt/ctdev/log/console.start.cmd
  |   |                                   |   `-java bla-bla-bla
  |   |                                   |       `-88*[{java}]
  |   |                                   `-tee -a /opt/ctdev/log/console.out

Is it possible somehow disable this check? Autocompletion worked just fine with 3.18, even output was redirected.

@gnodet gnodet added this to the 3.24.0 milestone Oct 24, 2023
gnodet added a commit to gnodet/jline3 that referenced this issue Oct 25, 2023
…output / error stream (fixes jline#856)

JLine tries to detect a valid output stream, but in cases where output is redirected using a tee command, the output stream is valid, even if not a real system stream.
Using builder.setSystemOutput(SystemOutput.ForcedSysOut) or using `org.jline.terminal.output=forced-out` system property solves the problem.
@gnodet gnodet closed this as completed in d4bf37c Oct 25, 2023
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

No branches or pull requests

2 participants