emersonford / tracing-indicatif

Tracing layer that automatically creates and manages progress bars for active spans.
MIT License
190 stars 5 forks source link

Suspend output for some time to interact with the console #4

Closed DCNick3 closed 1 year ago

DCNick3 commented 1 year ago

While it is possible to use the stdout/stderr wrappers to output something to the console, for some use-cases this is not enough.

I want to prompt the user with a selection using dialoguer, which wants to have the real terminal writer (by having an AsRawFd trait bound on the Term constructor).

I think this can be ultimately accomplished by exposing the suspend function of the MultiProgress, allowing to hide progress bars during the user interaction (as suggested in https://github.com/console-rs/indicatif/issues/158). This has a side-effect of blocking every other thing that tries to write to the output (including the tracing fmt layer if it was registered), but I think there's no real way to multiplex that..

emersonford commented 1 year ago

closed with v0.3.5, apologies it took a while for me to get around to this :)