Class ExecPty

All Implemented Interfaces:
Closeable, AutoCloseable, Pty

public class ExecPty extends AbstractExecPty
PTY implementation that uses external commands (stty, tty) to interact with the terminal. This is the default PTY implementation for POSIX systems.
  • Constructor Details

    • ExecPty

      protected ExecPty(String name)
      Constructs an ExecPty with the specified TTY name.
      Parameters:
      name - the name of the TTY device
  • Method Details

    • current

      public static Pty current() throws IOException
      Returns the PTY for the current terminal.
      Returns:
      the current PTY
      Throws:
      IOException - if not running in a TTY or an I/O error occurs
    • getSlaveInput

      public InputStream getSlaveInput() throws IOException
      Description copied from interface: Pty
      Returns the slave side input stream.
      Returns:
      the slave input stream
      Throws:
      IOException - if an I/O error occurs
    • getSlaveOutput

      public OutputStream getSlaveOutput() throws IOException
      Description copied from interface: Pty
      Returns the slave side output stream.
      Returns:
      the slave output stream
      Throws:
      IOException - if an I/O error occurs
    • getAttr

      public Attributes getAttr() throws IOException
      Description copied from interface: Pty
      Returns the current terminal attributes.
      Returns:
      the terminal attributes
      Throws:
      IOException - if an I/O error occurs
    • setAttr

      public void setAttr(Attributes attr) throws IOException
      Description copied from interface: Pty
      Sets the terminal attributes.
      Parameters:
      attr - the attributes to set
      Throws:
      IOException - if an I/O error occurs
    • getSize

      public Size getSize() throws IOException
      Description copied from interface: Pty
      Returns the current terminal size.
      Returns:
      the terminal size
      Throws:
      IOException - if an I/O error occurs
    • doGetConfig

      protected String doGetConfig() throws IOException
      Retrieves the terminal configuration using the stty command.
      Returns:
      the terminal configuration string
      Throws:
      IOException - if an I/O error occurs