Class CygwinTerminal

  • All Implemented Interfaces:
    Scrollable, InputProvider, ExtendedTerminal, Terminal, java.io.Closeable, java.lang.AutoCloseable

    public class CygwinTerminal
    extends UnixLikeTTYTerminal
    This class extends UnixLikeTerminal and implements the Cygwin-specific implementations. This means, running a Java application using Lanterna inside the Cygwin Terminal application. The standard Windows command prompt (cmd.exe) is not supported by this class.

    NOTE: This class is experimental and does not fully work! Some of the operations, like disabling echo and changing cbreak seems to be impossible to do without resorting to native code. Running "stty raw" before starting the JVM will improve compatibility.

    NOTE: This class will try to find Cygwin by scanning the directories on java.library.path, but you can also tell it where Cygwin is installed by setting the CYGWIN_HOME environment variable.

    • Field Detail

      • STTY_LOCATION

        private static final java.lang.String STTY_LOCATION
      • STTY_SIZE_PATTERN

        private static final java.util.regex.Pattern STTY_SIZE_PATTERN
      • JAVA_LIBRARY_PATH_PROPERTY

        private static final java.lang.String JAVA_LIBRARY_PATH_PROPERTY
        See Also:
        Constant Field Values
    • Constructor Detail

      • CygwinTerminal

        public CygwinTerminal​(java.io.InputStream terminalInput,
                              java.io.OutputStream terminalOutput,
                              java.nio.charset.Charset terminalCharset)
                       throws java.io.IOException
        Creates a new CygwinTerminal based off input and output streams and a character set to use
        Parameters:
        terminalInput - Input stream to read input from
        terminalOutput - Output stream to write output to
        terminalCharset - Character set to use when writing to the output stream
        Throws:
        java.io.IOException - If there was an I/O error when trying to initialize the class and setup the terminal
    • Method Detail

      • runSTTYCommand

        protected java.lang.String runSTTYCommand​(java.lang.String... parameters)
                                           throws java.io.IOException
        Overrides:
        runSTTYCommand in class UnixLikeTTYTerminal
        Throws:
        java.io.IOException
      • acquire

        protected void acquire()
                        throws java.io.IOException
        Description copied from class: UnixLikeTerminal
        Effectively taking over the terminal and enabling it for Lanterna to use, by turning off echo and canonical mode, adding resize listeners and optionally trap unix signals. This should be called automatically by the constructor of any end-user class extending from UnixLikeTerminal
        Overrides:
        acquire in class UnixLikeTTYTerminal
        Throws:
        java.io.IOException - If there was an I/O error
      • findSTTY

        private java.lang.String findSTTY()
      • getPseudoTerminalDevice

        private java.lang.String getPseudoTerminalDevice()
      • findProgram

        private static java.lang.String findProgram​(java.lang.String programName)