Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: relayer spinner #163

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

fix: relayer spinner #163

wants to merge 4 commits into from

Conversation

Pantani
Copy link
Collaborator

@Pantani Pantani commented Feb 3, 2025

The CLIUI uses the github.com/briandowns/spinner library, which checks if the output is a terminal since it can only be displayed in a terminal. The Ignite app adds a stdout layer, causing a misunderstanding about whether the output is a terminal.
This is a workaround for the library to prevent the spinner from being printed in the plugin. A better solution would involve changing the spinner logic or improving the detection mechanism.

Reference: https://github.com/briandowns/spinner/blob/master/spinner.go#L502-L506

@Pantani Pantani changed the title fix: relayer fix: relayer spinner Feb 7, 2025
Comment on lines +26 to +44
func stdOutRedirect() error {
// Save the current stdOut.
out := os.Stdout

// Create a new pseudo-terminal.
pty, tty, err := pty.Open()
if err != nil {
return errors.Errorf("Failed to create pty/tty: %v", err)
}

// Redirect os.Stdout and os.Stderr to the TTY.
os.Stdout = tty

// Start a goroutine to forward the output from the PTY to the real terminal.
go func() {
_, _ = io.Copy(out, pty) // Copy all output from the PTY to the real terminal.
}()
return nil
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is the workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant