llama-stack/llama_stack/cli/stack
Sébastien Han 24fd06879e
refactor: simplify command execution and remove PTY handling (#1641)
# What does this PR do?

A PTY is unnecessary for interactive mode since `subprocess.run()`
already inherits the calling terminal’s stdin, stdout, and stderr,
allowing natural interaction. Using a PTY can introduce unwanted side
effects like buffering issues and inconsistent signal handling. Standard
input/output is sufficient for most interactive programs.

This commit simplifies the command execution by:

1. Removing PTY-based execution in favor of direct subprocess handling
2. Consolidating command execution into a single run_command function
3. Improving error handling with specific subprocess error types
4. Adding proper type hints and documentation
5. Maintaining Ctrl+C handling for graceful interruption

## Test Plan

```
llama stack run
```

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-03-17 15:03:14 -07:00
..
__init__.py API Updates (#73) 2024-09-17 19:51:35 -07:00
_build.py refactor: simplify command execution and remove PTY handling (#1641) 2025-03-17 15:03:14 -07:00
build.py refactor: display defaults in help text (#1480) 2025-03-07 11:05:58 -08:00
list_apis.py API Updates (#73) 2024-09-17 19:51:35 -07:00
list_providers.py feat: support listing all for llama stack list-providers (#1056) 2025-02-12 22:03:28 -08:00
run.py refactor: simplify command execution and remove PTY handling (#1641) 2025-03-17 15:03:14 -07:00
stack.py fix: Incorrect import path for print_subcommand_description() (#1314) 2025-02-27 18:35:49 -08:00
utils.py chore: add subcommands description in help (#1219) 2025-02-27 17:00:27 -08:00