Skip to content

Kathara.foundation.manager.terminal.console.UnixConsoleAdapter

Tommaso Caiazzi edited this page Mar 19, 2026 · 1 revision

module Kathara.foundation.manager.terminal.console.UnixConsoleAdapter


function get_terminal_size_unix

get_terminal_size_unix() → Tuple[int, int]

Get the current terminal size (Unix).

Returns:

  • Tuple[int, int]: a tuple containing (cols, rows).

class UnixConsoleAdapter

Unix-specific console adapter.

Attributes:

  • _stdin_fd (int): File descriptor for stdin.
  • _stdout_fd (int): File descriptor for stdout.
  • _orig_term_attrs (Optional[list]): Saved terminal attributes for restoring on exit_raw().
  • _resize_handler_installed (bool): Whether resize watching is active.
  • _stdin_reader_installed (bool): Whether stdin reader is installed.

method UnixConsoleAdapter.__init__

__init__() → None

method UnixConsoleAdapter.enter_raw

enter_raw() → None

Put the terminal into raw mode.

Returns: None


method UnixConsoleAdapter.exit_raw

exit_raw() → None

Restore the terminal to its previous mode (reverts "enter_raw").

Returns: None


method UnixConsoleAdapter.install_input_reader

install_input_reader(
    loop: Any,
    on_bytes: Callable[[bytes], NoneType],
    on_close: Callable[[], NoneType]
) → None

Start reading from stdin and route incoming bytes to callbacks (connected to the manager handler).

Args:

  • loop (Any): The asyncio event loop instance used to register readers/tasks.
  • on_bytes (Callable[[bytes], None]): Callback to handle received input bytes.
  • on_close (Callable[[], None]): Callback to handle stdin closing or errors.

Returns: None


method UnixConsoleAdapter.remove_input_reader

remove_input_reader(loop: Any) → None

Stop reading stdin previously configured by "install_input_reader".

Args:

  • loop (Any): The asyncio event loop instance used to deregister.

Returns: None


method UnixConsoleAdapter.unwatch_resize

unwatch_resize(loop: Any) → None

Stop monitoring terminal resize events.

Args:

  • loop (Any): The asyncio event loop instance used to deregister signal handlers or callbacks.

Returns: None


method UnixConsoleAdapter.watch_resize

watch_resize(loop: Any, cb: Callable[[int, int], NoneType]) → None

Start monitoring terminal resize events.

Args:

  • loop (Any): The asyncio event loop instance used to register signal handlers or callbacks.
  • cb (Callable[[int, int], None]): Callback to handle the resize.

Returns: None


method UnixConsoleAdapter.write_stdout

write_stdout(data: bytes) → None

Write bytes to stdout.

Args:

  • data (bytes): Bytes to write to stdout.

Returns: None


This file was automatically generated via lazydocs.

Clone this wiki locally