[Bug] can't use indicatif inside progress callback
Opened this issue · 2 comments
thewh1teagle commented
When using indicatif in progress callback it crashes
use std::thread;
use std::time::Duration;
use indicatif::ProgressBar;
fn main() {
let pb = ProgressBar::new(100);
// setup whisper-rs model
// tried with move or without
// register progress callback
params.set_progress_callback_safe(move |progress| {
pb.set_position(progress);
});
pb.finish_with_message("done");
}
tazz4843 commented
Calling enable_steady_tick on the progress bar before doing anything more fixes it for this specific case. I'm tempted to remove set_progress_callback_safe until it can be rewritten after this issue since this is interesting.
thewh1teagle commented
I found this workround
https://github.com/thewh1teagle/vibe/blob/main/core/src/model.rs#L58