Package ghidra.pty

# Interface PtyChild

All Superinterfaces:
  `PtyEndpoint`

All Known Implementing Classes:
  `ConPtyChild`, `UnixPtyChild`

public interface PtyChild extends PtyEndpoint
The child (UNIX "slave") end of a pseudo-terminal

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static enum`
  `PtyChild.Echo`
  Mode flag for local echo
  `static interface`
  `PtyChild.TermMode`
  A terminal mode flag

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default String`
  `nullSession(PtyChild.TermMode... mode)`
  `String`
  `nullSession(Collection<PtyChild.TermMode> mode)`
  Start a session without a real leader, instead obtaining the pty's name
  `default PtySession`
  `session(String[] args, Map<String,String> env, PtyChild.TermMode... mode)`
  `default PtySession`
  `session(String[] args, Map<String,String> env, File workingDirectory, PtyChild.TermMode... mode)`
  `PtySession`
  `session(String[] args, Map<String,String> env, File workingDirectory, Collection<PtyChild.TermMode> mode)`
  Spawn a subprocess in a new session whose controlling tty is this pseudo-terminal
  `void`
  `setWindowSize(short cols, short rows)`
  Resize the terminal window to the given width and height, in characters

  ### Methods inherited from interface ghidra.pty.PtyEndpoint

  `getInputStream, getOutputStream`

- ## Method Details

  - ### session

    PtySession session(String[] args, Map<String,String> env, File workingDirectory, Collection<PtyChild.TermMode> mode) throws IOException
    Spawn a subprocess in a new session whose controlling tty is this pseudo-terminal

    This method or `nullSession(Collection)` can only be invoked once per pty.

    Parameters:
      `args` - the image path and arguments
      `env` - the environment
      `workingDirectory` - the working directory
      `mode` - the terminal mode. If a mode is not implemented, it may be silently ignored.
    Returns:
      a handle to the subprocess
    Throws:
      `IOException` - if the session could not be started

  - ### session

    default PtySession session(String[] args, Map<String,String> env, File workingDirectory, PtyChild.TermMode... mode) throws IOException
    Parameters:
      `args` - the image path and arguments
      `env` - the environment
      `workingDirectory` - the working directory
      `mode` - the terminal mode. If a mode is not implemented, it may be silently ignored.
    Returns:
      a handle to the subprocess
    Throws:
      `IOException` - if the session could not be started
    See Also:
      - `session(String[], Map, File, Collection)`

  - ### session

    default PtySession session(String[] args, Map<String,String> env, PtyChild.TermMode... mode) throws IOException
    Parameters:
      `args` - the image path and arguments
      `env` - the environment
      `mode` - the terminal mode. If a mode is not implemented, it may be silently ignored.
    Returns:
      a handle to the subprocess
    Throws:
      `IOException` - if the session could not be started
    See Also:
      - `session(String[], Map, File, Collection)`

  - ### nullSession

    String nullSession(Collection<PtyChild.TermMode> mode) throws IOException
    Start a session without a real leader, instead obtaining the pty's name

    This method or any other `session` method can only be invoked once per pty. It must be called before anyone reads the parent's output stream, since obtaining the filename may be implemented by the parent sending commands to its child.

    If the child end of the pty is on a remote system, this should be the file (or other resource) name as it would be accessed on that remote system.

    Parameters:
      `mode` - the terminal mode. If a mode is not implemented, it may be silently ignored.
    Returns:
      the file name
    Throws:
      `IOException` - if the session could not be started or the pty name could not be determined

  - ### nullSession

    default String nullSession(PtyChild.TermMode... mode) throws IOException
    Parameters:
      `mode` - the terminal mode. If a mode is not implemented, it may be silently ignored.
    Returns:
      the file name
    Throws:
      `IOException` - if the session could not be started or the pty name could not be determined
    See Also:
      - `nullSession(Collection)`

  - ### setWindowSize

    void setWindowSize(short cols, short rows)
    Resize the terminal window to the given width and height, in characters
    Parameters:
      `cols` - the width in characters
      `rows` - the height in characters