Drop-in replacement for claude -p that drives the interactive TUI via PTY, preserving subscription billing
- Install a SIGWINCH handler that sets a static AtomicBool; the relay loop re-issues TIOCSWINSZ on the master fd each time it fires. - relay() poll-loops over the master fd and stdin, copying master output to stdout and stdin input to the master fd, with 100 ms timeout so SIGWINCH is handled promptly on EINTR. - Loop exits on EIO/EOF/POLLHUP from the master fd (slave side closed). - waitpid() at the end of relay() surfaces the child exit code (or 128+signum for signal termination). - New tests: master_fd_carries_child_stdout (acceptance criterion), relay_echo_exits_zero_and_produces_output, relay_surfaces_nonzero_exit_code. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .beads | ||
| docs | ||
| src | ||
| test-fixtures/mock-claude | ||
| Cargo.lock | ||
| Cargo.toml | ||
| README.md | ||
claude-print
Drop-in replacement for claude -p (print/headless mode) that drives the Claude Code interactive TUI via PTY — preserving subscription billing after the June 15, 2026 Agent SDK credit split.
Why this exists
Starting June 15, 2026, Anthropic separates claude -p (headless) into a separate Agent SDK credit pool ($100–$200/month on Max plans). Only the interactive TUI (cc_entrypoint=cli) continues drawing from the unlimited subscription. claude-print wraps the interactive TUI in a PTY so callers get claude -p wire-compatible output while billing against the subscription.
Structure
docs/notes/— design decisions, constraints, integration detailsdocs/plan/plan.md— complete implementation plan