console-rs / indicatif

A command line progress reporting library for Rust
MIT License
4.47k stars 244 forks source link

fix `ProgressState::duration()` overflow #560

Closed alexheretic closed 1 year ago

alexheretic commented 1 year ago

In scenarios where the ProgressState::eta() returns very high/maxed Duration, calling ProgressState::duration() can panic as elapsed + eta overflows.

This PR avoids that panic. In this scenario ProgressState::duration() will return Duration::MAX.

Fixes #561