canonical / craft-cli

Home Page:https://canonical-craft-cli.readthedocs-hosted.com/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

facundobatista opened this issue · comments

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).