Package ghidra.pty.windows

# Class ConPtyChild

java.lang.Object
ghidra.pty.windows.ConPtyEndpoint
ghidra.pty.windows.ConPtyChild

All Implemented Interfaces:
  `PtyChild`, `PtyEndpoint`

public class ConPtyChild extends ConPtyEndpoint implements PtyChild

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface ghidra.pty.PtyChild

  `PtyChild.Echo, PtyChild.TermMode`

- ## Field Summary

  ### Fields inherited from class ghidra.pty.windows.ConPtyEndpoint

  `inputStream, outputStream, pseudoConsoleHandle`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ConPtyChild(Handle writeHandle, Handle readHandle, PseudoConsoleHandle pseudoConsoleHandle)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `nullSession(Collection<PtyChild.TermMode> mode)`
  Start a session without a real leader, instead obtaining the pty's name
  `protected ConsoleApiNative.STARTUPINFOEX`
  `prepareStartupInfo()`
  `LocalWindowsNativeProcessPtySession`
  `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 class ghidra.pty.windows.ConPtyEndpoint

  `getInputStream, getOutputStream`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

  `nullSession, session, session`

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

  `getInputStream, getOutputStream`

- ## Constructor Details

  - ### ConPtyChild

    public ConPtyChild(Handle writeHandle, Handle readHandle, PseudoConsoleHandle pseudoConsoleHandle)

- ## Method Details

  - ### prepareStartupInfo

    protected ConsoleApiNative.STARTUPINFOEX prepareStartupInfo()

  - ### session

    public LocalWindowsNativeProcessPtySession session(String[] args, Map<String,String> env, File workingDirectory, Collection<PtyChild.TermMode> mode) throws IOException
    Description copied from interface: `PtyChild`
    Spawn a subprocess in a new session whose controlling tty is this pseudo-terminal

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

    Specified by:
      `session` in interface `PtyChild`
    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

  - ### nullSession

    public String nullSession(Collection<PtyChild.TermMode> mode) throws IOException
    Description copied from interface: `PtyChild`
    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.

    Specified by:
      `nullSession` in interface `PtyChild`
    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