# _platform

URL: /milo-cli/api/milo/input/_platform/
Section: input
Description: Platform abstraction for terminal raw mode and character reading.

---

> For a complete page index, fetch /milo-cli/llms.txt.

Open LLM text
(/milo-cli/api/milo/input/_platform/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Finput%2F_platform%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Finput%2F_platform%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Finput%2F_platform%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Finput%2F_platform%2Findex.txt)

Module

#
`input._platform`

Platform abstraction for terminal raw mode and character reading.

4Functions

## Functions

`raw_mode`

1

`Generator[None]`

▼

Context manager that puts the terminal into raw mode.

Restores original settin…

`def raw_mode(fd: int | None = None) -> Generator[None]`

Context manager that puts the terminal into raw mode.

Restores original settings on exit.

##### Parameters

Name
Type
Description

`fd`
`int | None`

Default:`None`

##### Returns

`Generator[None]`

`read_char`

1

`str`

▼

Read a single character from the terminal.

Must be called within a raw_mode() …

`def read_char(fd: int | None = None) -> str`

Read a single character from the terminal.

Must be called within a raw_mode() context.

##### Parameters

Name
Type
Description

`fd`
`int | None`

Default:`None`

##### Returns

`str`

`read_available`

2

`str`

▼

Read all immediately available bytes (non-blocking).

Used to consume multi-byt…

`def read_available(fd: int | None = None, max_bytes: int = 16) -> str`

Read all immediately available bytes (non-blocking).

Used to consume multi-byte escape sequences after the initial escape.

##### Parameters

Name
Type
Description

`fd`
`int | None`

Default:`None`

`max_bytes`
`int`

Default:`16`

##### Returns

`str`

`is_tty`

1

`bool`

▼

Check if fd is connected to a terminal.

`def is_tty(fd: int | None = None) -> bool`

##### Parameters

Name
Type
Description

`fd`
`int | None`

Default:`None`

##### Returns

`bool`
