Skip to content

Provide the platform input/signal stubs on wasip1/wasip2 - #1767

Open
calvinrp wants to merge 1 commit into
charmbracelet:mainfrom
calvinrp:wasip1-stubs
Open

Provide the platform input/signal stubs on wasip1/wasip2#1767
calvinrp wants to merge 1 commit into
charmbracelet:mainfrom
calvinrp:wasip1-stubs

Conversation

@calvinrp

Copy link
Copy Markdown

Hi, and thanks for maintaining Bubble Tea!

Since Go 1.21 added GOOS=wasip1 (WASI preview 1), building bubbletea (the v2 line) for the WASI platforms fails, because the per-platform files select nothing there:

tea.go:690:8: p.listenForResize undefined
tea.go:772:8: undefined: suspendSupported
tty.go:18:9: undefined: suspendProcess
tty.go:28:14: p.initInput undefined

tty_unix.go and signals_unix.go are gated to an explicit Unix GOOS list, and tty_windows.go/signals_windows.go to Windows. This breaks downstream users on wasip1 — for example gh (github.com/cli/cli), which imports bubbletea via its accessible prompter.

WASI preview 1/2 has no raw terminal mode, no process groups (so no SIGTSTP suspend), and no SIGWINCH. The natural behavior is the one Bubble Tea already supports for non-terminal input:

  • initInput succeeds without opening a TTY, selecting the non-TTY (pipe) input path
  • suspendSupported = false and a no-op suspendProcess
  • listenForResize closes its done channel immediately (no resize events)

Verified:

  • GOOS=wasip1 GOARCH=wasm go build . now succeeds
  • native and Windows builds select the same files as before

🤖 Generated with Claude Code

Building bubbletea v2 for GOOS=wasip1 (added in Go 1.21) fails with
initInput, suspendSupported, suspendProcess, and listenForResize
undefined: tty_unix.go and signals_unix.go are gated to an explicit
Unix GOOS list, tty_windows.go/signals_windows.go to Windows, and the
WASI platforms select nothing. WASI has no raw mode, no process groups
(SIGTSTP), and no SIGWINCH, so the stubs pick the non-TTY input path,
disable suspend, and complete resize listening immediately.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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