console-rs / indicatif

A command line progress reporting library for Rust
MIT License
4.43k stars 243 forks source link

Using rayon's `par_iter`, progress' are not rendered properly. #269

Closed pombadev closed 3 years ago

pombadev commented 3 years ago

rayon-ind

Steps to reproduce:

1) Clone: https://github.com/pjmp/indicatif-rayon 2) cargo run

Toggle comments in line 11-14 to see the difference.

djc commented 3 years ago

Can you try with indicatif's main branch? There've been quite a few changes.

mibac138 commented 3 years ago

This is somewhat expected. When you call set_draw_target you unlink the progress bar from the multi progress. When you have a single thread, each progress bar is drawn sequentially, one after another, seemingly working fine, however when you run the progress bars concurrently the bug is now exposed as they draw concurrently and override one another. You probably want to remove ProgressBar::set_draw_target and instead use MultiProgress::set_draw_target.