Run interactive programs with simple command-based I/O.
Interactive programs require back-and-forth communication that's hard to automate:
- Password prompts
- Interactive installers ("Continue? [y/n]")
- REPLs (Python, Node, etc.)
pty-wrap runs programs in a PTY and provides simple subcommands for interaction:
pty-wrap start -- python3 double_number.py # Start, get session ID
pty-wrap read <session> # Read output (auto-cleans if exited)
pty-wrap send <session> "answer" # Send input (safe, with timeout)
pty-wrap status <session> # Check if running/exited
pty-wrap stop <session> # Force stop and clean up
pty-wrap list # Show all sessionsJust install it and tell your favourite coding agent to use it - it should figure it out fine.
uv tool install git+https://github.com/ahoydave/pty-wrap# Start an interactive program like our example
$ pty-wrap start -- python3 double_number.py
session: abc12345
# Read what it printed
$ pty-wrap read abc12345
What is 42 doubled?
# Send your answer
$ pty-wrap send abc12345 "84"
ok
# Read the response (auto-cleans up since process exited)
$ pty-wrap read abc12345
What is 42 doubled?
84
Correct!
[pty-wrap: process exited]| Feature | Pipe | PTY |
|---|---|---|
| Input echo | No | Yes |
isatty() returns |
False | True |
| Colored output | Usually disabled | Works |
| Signal chars (Ctrl+C) | No | Yes |
Many programs check isatty() and disable interactive features when connected to pipes. With a PTY, they behave exactly as if a human were using a terminal.
- macOS: ✅ Fully supported
- Linux: ✅ Fully supported
- Windows: ❌ Not supported (no PTY)
MIT