Skip to content

Hide get.py download percent when not interactive #6852

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

Merged
merged 1 commit into from
Jun 12, 2022

Conversation

earlephilhower
Copy link
Contributor

Description of Change

When get.py is run in a script the percent-update printouts shown while
downloading the toolchain end up as 100s to 1000s of lines in log files.

When stdout is not a terminal, avoid printing these percentages and
shrink logfiles significantly. Errors/etc. are still reported as normal.

This is a "nice to have" and does not impact functionality.

Tests scenarios

Run cd tools; rm -f dist/*; python3 get.py > log on a clean installation
and open the log in vi log and see:

M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0%^M0....

In GitHub CI logs you'll end up with 100s of lines like

Downloading riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch3-linux-amd64.tar.gz ...

0%
0%
0%
0%
0%
0%
0%
0%
0%
0%

With this change, the output is simply:

System: Linux, Bits: 64, Info: Linux-5.13.0-44-generic-x86_64-with-glibc2.29
Platform: x86_64-pc-linux-gnu
Downloading riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch3-linux-amd64.tar.gz ...
Done
Extracting riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch3-linux-amd64.tar.gz ...

Related links

When get.py is run in a script the percent-update printouts shown while
downloading the toolchain end up as 100s to 1000s of lines in log files.

When stdout is not a terminal, avoid printing these percentages and
shrink logfiles significantly.  Errors/etc. are still reported as normal.
@me-no-dev
Copy link
Member

Thanks @earlephilhower

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

Successfully merging this pull request may close these issues.

2 participants