Skip to content

refactor: replace creack/pty with aymanbagabas/go-pty for cross-platform PTY support (Refs: beans-bz15)#168

Merged
hmans merged 2 commits intomainfrom
beans/rapid-puffin-27lg
Mar 20, 2026
Merged

refactor: replace creack/pty with aymanbagabas/go-pty for cross-platform PTY support (Refs: beans-bz15)#168
hmans merged 2 commits intomainfrom
beans/rapid-puffin-27lg

Conversation

@hmans
Copy link
Copy Markdown
Owner

@hmans hmans commented Mar 20, 2026

Summary

  • Replace creack/pty (Unix-only, unmaintained) with aymanbagabas/go-pty which provides a unified Pty interface for Unix PTY and Windows ConPTY
  • Session struct now holds gopty.Pty (io.ReadWriteCloser + Resize) and *gopty.Cmd instead of raw *os.File + *exec.Cmd
  • Add defaultShell() helper that picks pwsh.exe/cmd.exe on Windows, $SHELL or /bin/sh on Unix
  • No public API changes — all Session and Manager method signatures are unchanged
  • creack/pty remains as an indirect dependency (go-pty wraps it on Unix)

Test plan

  • All Go unit tests pass (internal/terminal included)
  • All 60 Playwright e2e tests pass
  • Manual smoke test: terminal sessions in Beans UI work as expected

hmans added 2 commits March 20, 2026 19:00
…orm PTY support (Refs: beans-bz15)

- Swap creack/pty (Unix-only, unmaintained) for go-pty which provides
  a unified API for Unix PTY and Windows ConPTY
- Session struct now holds gopty.Pty interface + *gopty.Cmd instead of
  raw *os.File + *exec.Cmd
- Add defaultShell() helper with Windows support (pwsh.exe/cmd.exe fallback)
- No public API changes to Session or Manager
… Linux (Refs: beans-bz15)

- go-pty keeps the slave fd open in the parent process after cmd.Start()
- On Linux, this prevents the master from receiving EOF when the child exits
- Add closeSlave() helper that closes the slave fd via the UnixPty interface
- Fixes TestCreateWithCommandExits timeout on Linux CI
@hmans hmans merged commit 5fd2269 into main Mar 20, 2026
1 check passed
@hmans hmans deleted the beans/rapid-puffin-27lg branch March 20, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant