Showing progress bar in terminal

I want to show a good looking progress bar :slight_smile: on terminal while flashing but I am unable to do that. isatty() always return false when running pio run --target flash
whereas if I run flasher binary directly isatty() returns true and everything works as expected. Is there a hack to get nice looking progress bar? or at least to get \r working as expected?

@pfeerick can you help me out :slight_smile:

Now, why would you think I can help? :stuck_out_tongue:

I’m afraid I don’t know much about that side of things. I seem to remember something from the release notes for PlatformIO from an earlier release about something to do with buffering or something to do with terminal output, so that’s probably what you’re running afoul of… er, no, the opposite of that… removal of buffering to allow progress bars to work… hm… ok… I’ll just shut up now!!

I’ll let you ping Ivan, I’ve used my quota for the week! :laughing:

lol I just wanted to have some chat on the topic :smiley: rather I wanted someone to ask me what is wrong :laughing:

I actually don’t know much about team here. I just know you and Ivan and Valerii (he responded once :slight_smile:) So I thought you might at least help me reach the right person :wink: Just for the sake of information, buffering is disabled but carriage return gets translated to carriage return and line feed which fills the whole screen and does not look good aesthetically (only few people care about aesthetics of programming :slight_smile:) I did do the alternate to check whether console is a tty or not based on that progress bar is shown but I am not happy they way it looks though :stuck_out_tongue:

1 Like

PlatformIO is Ivan’s baby, and AFAIK Valerii is the main platform support developer. Max, Manuel and myself are volunteer moderators who help out where we can.

1 Like

Maybe that’s why Ivan is so busy and always occupied. It feels bad to ping him again and again to be true. PlatformIO team has a lot of burden as they are maintaining almost all the platforms themselves.

1 Like

Quite possibly. That’s why I only ping to draw attention to stuff that I think he is the best placed/person to answer. This fits :wink:

did we find out how to fix this one. not a big deal just pollutes the console on every upload. thanks so much, I just did the final conversion from ArduinoIDE to Emacs Arduino-cli to Emacs with PlatformIO. fun ride.

Not really, as I mentioned earlier. I just put a check if terminal is a tty then print in fancy way else just print the output in normal way.
here is my implementation:
https://github.com/siwiembedded/tool-pysiwiflasher/blob/master/siwiflasher.py#L133

1 Like