-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Describe the bug
The init() function calls _ = lipgloss.HasDarkBackground(), which accesses the terminal and produces OSC/DSR sequences (e.g., ^[]11;rgb:0000/0000/0000^[\^[[78;1R) before main().
This output appears when the program is run via spawn in an expect script.
Setup
- OS: macOS
- Shell: bash
- Terminal Emulator: iTerm2
- Terminal Multiplexer: no
To Reproduce
- Write an expect script that uses
spawnto run a Bubble Tea program. - Observe that terminal sequences are printed before main() executes.
Source Code
#!/usr/bin/env expect
spawn ./program
expect "Hello"
interactpackage main
import (
"flag"
"fmt"
tea "github.com/charmbracelet/bubbletea"
)
func main() {
useTea := flag.Bool("tea", false, "use Bubble Tea")
flag.Parse()
if *useTea {
tea.Println("Hello, Tea.")
return
}
fmt.Println("Hello, World.")
}Expected behavior
The init() function should not produce unwanted terminal output when the program is run via spawn in an expect script.
Screenshots
$ ./expect.sh
spawn ./program
^[]11;rgb:0000/0000/0000^[\^[[78;1RHello, World.
^[]11;rgb:0000/0000/0000^[\^[[78;1RAdditional context
Consider performing terminal detection lazily, e.g., with sync.Once when it is actually needed in the program.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels