Class ExecPty

java.lang.Object
org.aesh.terminal.tty.impl.ExecPty
All Implemented Interfaces:
Closeable, AutoCloseable, Pty

public class ExecPty extends Object implements Pty
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
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • getName

      public String getName()
      Returns the name of the TTY device.
      Returns:
      the TTY device name
    • getMasterInput

      public InputStream getMasterInput()
      Description copied from interface: Pty
      Returns the master side input stream.
      Specified by:
      getMasterInput in interface Pty
      Returns:
      the master input stream
    • getMasterOutput

      public OutputStream getMasterOutput()
      Description copied from interface: Pty
      Returns the master side output stream.
      Specified by:
      getMasterOutput in interface Pty
      Returns:
      the master output stream
    • getSlaveInput

      public InputStream getSlaveInput() throws IOException
      Description copied from interface: Pty
      Returns the slave side input stream.
      Specified by:
      getSlaveInput in interface Pty
      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.
      Specified by:
      getSlaveOutput in interface Pty
      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.
      Specified by:
      getAttr in interface Pty
      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.
      Specified by:
      setAttr in interface Pty
      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.
      Specified by:
      getSize in interface Pty
      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