tazz4843/whisper-rs

[Bug] can't use indicatif inside progress callback

Opened this issue · 2 comments

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");
}

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.