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
  • 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

      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:
    • 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:
    • 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