mcpwn API
    Preparing search index...

    Function openControllingTty

    • Open the operator's controlling terminal for interactive use, independent of stdin/stdout (which carry the MCP protocol and must stay byte-clean — Invariant #1).

      • POSIX exposes the controlling terminal as /dev/tty.
      • Windows exposes the console as the special device names CONIN$ (input) and CONOUT$ (output).

      Returns null when no controlling terminal can be opened — e.g. the proxy was spawned by a GUI client with no attached console. Callers must then degrade gracefully to auto-forward rather than trapping the wire.

      open/close/plat are injectable so the return-shape can be unit-tested without a real console (interactive end-to-end testing stays manual). Tests MUST inject close too — otherwise the real closeSync would act on the fake fd numbers the fake open returns, closing live descriptors.

      Parameters

      • open: OpenFn = openSync
      • plat: Platform = process.platform
      • close: CloseFn = closeSync

      Returns ControllingTty | null