Skip to content

Can't redirect output of non-interactive application #663

Answered by mcastorina
tim-hilt asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @tim-hilt, I think what's happening here is your Update method is used to signal bubbletea to quit. You'll notice if you hit a key the program will exit.

Normally, there's always one message for Update on initialization to provide information on the screen size, but since we redirect I think that event isn't happening.

Changing the Init() method to return tea.Quit seems to work, though idk why it's still able to display the table when not redirecting. It seems View() is called at least once before exitting. By my crude testing, it's called twice with this solution.

Replies: 10 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by bashbunni
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #618 on February 15, 2023 19:34.