canonical / craft-cli

https://canonical-craft-cli.readthedocs-hosted.com/en/latest/
GNU Lesser General Public License v3.0
9 stars 15 forks source link

Repeated same-text message makes the spinner and elapsed time look weird #138

Closed facundobatista closed 8 months ago

facundobatista commented 1 year ago

This example (use it in examples.py will make the problem evident:

def example_99():
    emit.message("Begin")
    for _ in range(10):
        emit.progress("Middle message that will be repeated...")
        time.sleep(5)
    emit.message("End")

There the same message is emitted over and over again, with a time elapsed between. This is a normal case where some polling is done to see if a process finished, while showing a message on every check (Charmcraft itself suffers this when polling the Store after an upload).

The effect is that initially the middle message appears, and after a couple of seconds the spinner and time counter is shown. Some seconds later the middle message is emitted again, and the spinner and time counter disappears, only to appear again after another couple of seconds.

What should happen is that if the same message is emitted again, it should not hide the previous spinner and time counter (which should not be reset, of course).