Maven and TTY terminal

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Maven and TTY terminal

Petar Tahchiev
Hi guys,

my setup is Ubuntu Linux and Java8. I'm trying to use JLine from Maven to
get a TerminalBuild and determine the size of the command line. So JLine
has this code inside TerminalBuilder;

Pty pty = load(JansiSupport.class).current();

private <S> S load(Class<S> clazz) {
    return ServiceLoader.load(clazz, clazz.getClassLoader()).iterator().next();

When I call JBuilder from one of my annotation processors during
compilation, then Pty is successfully created and so I get a
TerminalBuilder and it all works fine. However, when I call it from one of
my JUnit tests the code throws this exception when .current() is invoked: Not a tty
    at org.jline.terminal.TerminalBuilder.doBuild(

JLine can also use JNA, but when I added the JNA dependency the story is
the same - when running it from surefire plugin the exception is:

com.sun.jna.LastErrorException: [25] Inappropriate ioctl for device
    at com.sun.jna.Native.invokeVoid(Native Method)
    at com.sun.jna.Function.invoke(
    at com.sun.jna.Function.invoke(

Do you know why this happens? Is there any setting that I can set on the
surefire plugin to avoid these types of error?
Regards, Petar!
Karlovo, Bulgaria.
Public PGP Key at:
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611