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

[Bug] can't use indicatif inside progress callback #114

Open
thewh1teagle opened this issue Jan 10, 2024 · 2 comments
Open

[Bug] can't use indicatif inside progress callback #114

thewh1teagle opened this issue Jan 10, 2024 · 2 comments

Comments

@thewh1teagle
Copy link
Contributor

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
Copy link
Owner

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
Copy link
Contributor Author

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

2 participants