Class PTY

java.lang.Object
org.eclipse.cdt.utils.pty.PTY
Direct Known Subclasses:
PersistentPTY

public class PTY extends Object
PTY - pseudo terminal support.
  • Constructor Details

    • PTY

      public PTY() throws IOException
      Create PTY for use with Eclipse console. Identical to PTY(Mode.CONSOLE).
      Throws:
      IOException
    • PTY

      public PTY(PTY.Mode mode) throws IOException
      Create PTY for given mode.

      The provided mode indicates whether the pseudo terminal is used with the interactive Eclipse console or a terminal emulation:

      • CONSOLE - the terminal is configured with no echo and stderr is redirected to a pipe instead of the PTY. This mode is not supported on windows
      • TERMINAL - the terminal is configured with echo and stderr is connected to the PTY. This mode is best suited for use with a proper terminal emulation. Note that this mode might not be supported on all platforms. Known platforms which support this mode are: linux-x86, linux-x86_64, solaris-sparc, macosx.

      Parameters:
      mode - the desired mode of operation
      Throws:
      IOException - if the PTY could not be created
      Since:
      5.6
  • Method Details

    • isSupported

      @Deprecated public static boolean isSupported()
      Deprecated.
      Returns:
      whether PTY support for console mode is available on this platform
    • isSupported

      public static boolean isSupported(PTY.Mode mode)
      Returns:
      whether PTY support for given mode is available on this platform
      Since:
      5.6
    • validateSlaveName

      public void validateSlaveName() throws IOException
      Test whether the slave name can be used as a tty device by external processes (e.g. gdb). If the slave name is not valid an IOException is thrown.
      Throws:
      IOException - if the slave name is not valid
      Since:
      5.6
    • getSlaveName

      public String getSlaveName()
    • getMasterFD

      public PTY.MasterFD getMasterFD()
    • isConsole

      public final boolean isConsole()
      Returns:
      whether this pseudo terminal is for use with the Eclipse console.
      Since:
      5.2
    • getOutputStream

      public PTYOutputStream getOutputStream()
    • getInputStream

      public PTYInputStream getInputStream()
    • setTerminalSize

      public final void setTerminalSize(int width, int height)
      Change terminal window size to given width and height.

      This should only be used when the pseudo terminal is configured for use with a terminal emulation, i.e. when isConsole() returns false.

      Note: This method may not be supported on all platforms. Known platforms which support this method are: linux-x86, linux-x86_64, solaris-sparc, macosx.

      Since:
      5.2
    • exec_pty

      public int exec_pty(Spawner spawner, String[] cmdarray, String[] envp, String dir, Spawner.IChannel[] chan) throws IOException
      Throws:
      IOException
      Since:
      5.6
      Restriction:
      This method is not intended to be referenced by clients.
    • waitFor

      public int waitFor(Spawner spawner, int pid)
      Since:
      5.6
      Restriction:
      This method is not intended to be referenced by clients.