Fallback when pexpect is not installed. Opens CLI with tee capture; user must type the prompt manually.
(cli_name: str, cmd: str, prompt_text: str)
| 480 | |
| 481 | |
| 482 | def _run_basic_fallback(cli_name: str, cmd: str, prompt_text: str) -> str: |
| 483 | """ |
| 484 | Fallback when pexpect is not installed. |
| 485 | Opens CLI with tee capture; user must type the prompt manually. |
| 486 | """ |
| 487 | import tempfile |
| 488 | width = _terminal_width() |
| 489 | outfile = tempfile.mktemp(prefix="codey_peer_", suffix=".txt") |
| 490 | |
| 491 | print(f"\n{_CYAN}{_header(cli_name.upper() + ' CLI (manual mode)', width)}{_RESET}") |
| 492 | if prompt_text: |
| 493 | print(f"\n{_DIM}── Paste this into {cli_name} ──{_RESET}") |
| 494 | print(f"{_DIM}{prompt_text}{_RESET}") |
| 495 | print(f"{_DIM}{'─' * width}{_RESET}\n") |
| 496 | |
| 497 | os.system(f'{cmd} 2>&1 | tee "{outfile}"') |
| 498 | |
| 499 | print(f"\n{_CYAN}{_header(cli_name.upper() + ' DONE', width)}{_RESET}\n") |
| 500 | info(f"Reading {cli_name} output…") |
| 501 | |
| 502 | try: |
| 503 | import pathlib |
| 504 | out = pathlib.Path(outfile).read_text(encoding="utf-8", errors="replace") |
| 505 | pathlib.Path(outfile).unlink(missing_ok=True) |
| 506 | return out |
| 507 | except Exception: |
| 508 | return "" |
no test coverage detected