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

How to maintain Exec output after exit of inner Exec process ? #1275

Open
raphaelvigee opened this issue Dec 27, 2024 · 1 comment
Open

How to maintain Exec output after exit of inner Exec process ? #1275

raphaelvigee opened this issue Dec 27, 2024 · 1 comment

Comments

@raphaelvigee
Copy link

raphaelvigee commented Dec 27, 2024

When into exec mode, execs will print a bunch of things to stdout, when the process exits and returns control to bbt, bbt will wipe the output, how to maintain what was previously outputed ?

@raphaelvigee raphaelvigee changed the title When switching into exec mode, it should flush the outstanding Println messages How to maintain Exec output after exit of inner Exec process ? Dec 27, 2024
@raphaelvigee
Copy link
Author

I believe the fix is as simple as

diff --git a/exec.go b/exec.go
index 7a14d2a..2dbc1f9 100644
--- a/exec.go
+++ b/exec.go
@@ -121,6 +121,8 @@ func (p *Program) exec(c ExecCommand, fn ExecCallback) {
                return
        }

+       p.renderer.(*standardRenderer).linesRendered = 0
+
        // Have the program re-capture input.
        err := p.RestoreTerminal()
        if fn != nil {

would this be worth adding to the renderer interface ? (resetLinesRendered()) ?

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

No branches or pull requests

1 participant