Package ghidra.pty

# Interface PtyChild

All Superinterfaces:
  `PtyEndpoint`

All Known Implementing Classes:
  `ConPtyChild`, `LinuxPtyChild`, `SshPtyChild`

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

  ### 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
    Throws:
      `IOException`
    See Also:
      - `session(String[], Map, File, Collection)`

  - ### session

    default PtySession session(String[] args, Map<String,String> env, PtyChild.TermMode... mode) throws IOException
    Throws:
      `IOException`
    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
    Throws:
      `IOException`
    See Also:
      - `nullSession(Collection)`