Determine if the session supports full terminal interactions. Returns True if the session is attached to a real TTY or a virtual terminal (like PipeInput in tests). Returns False if the session is running in a headless environment (DummyInput).
(session: PromptSession[str])
| 3420 | |
| 3421 | @staticmethod |
| 3422 | def _is_tty_session(session: PromptSession[str]) -> bool: |
| 3423 | """Determine if the session supports full terminal interactions. |
| 3424 | |
| 3425 | Returns True if the session is attached to a real TTY or a virtual |
| 3426 | terminal (like PipeInput in tests). Returns False if the session is |
| 3427 | running in a headless environment (DummyInput). |
| 3428 | """ |
| 3429 | # Validate against the session's assigned input driver rather than sys.stdin. |
| 3430 | # This respects the fallback logic in _create_main_session() and allows unit |
| 3431 | # tests to inject PipeInput for programmatic interaction even if paired with |
| 3432 | # a DummyOutput. |
| 3433 | return not isinstance(session.input, DummyInput) |
| 3434 | |
| 3435 | def _read_raw_input( |
| 3436 | self, |
no outgoing calls
no test coverage detected