Skip to content

Commit 9c3d835

Browse files
authored
fix: write interactive prompts to stderr when stdout is redirected (#4750)
2 parents 94c27a8 + f883397 commit 9c3d835

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

internal/utils/prompt.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"io"
7+
"os"
78
"strings"
89

910
"github.com/charmbracelet/bubbles/list"
@@ -123,6 +124,8 @@ func PromptChoice(ctx context.Context, title string, items []PromptItem, opts ..
123124
// Create our model
124125
ctx, cancel := context.WithCancel(ctx)
125126
initial := model{cancel: cancel, list: l}
127+
// Interactive prompts should always be written to stderr
128+
opts = append(opts, tea.WithOutput(os.Stderr))
126129
prog := tea.NewProgram(initial, opts...)
127130
state, err := prog.Run()
128131
if err != nil {

0 commit comments

Comments
 (0)