Skip to content
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

Logging based on terminal size #434

Open
thmahe opened this issue Sep 16, 2024 · 0 comments · May be fixed by #435
Open

Logging based on terminal size #434

thmahe opened this issue Sep 16, 2024 · 0 comments · May be fixed by #435

Comments

@thmahe
Copy link

thmahe commented Sep 16, 2024

Significant number of spaces are present at end of progress related lines based on terminal width.

While using uuu in non-terminal environment, 80k+ spaces are printed for each lines while using redirection.
This issue cause uuu producing significant amount of logs in LAVA test framework.

Expected Behavior

Standard output should minimize the number of trailing spaces caused by progress bars.

Current Behavior

Strings used for logging purposes are initialized with spaces based on terminal size.
For each progress steps spaces are printed on standard output to flush previous result.

Possible Solution

  • Printing spaces only to remove previous line (based on actual size)
  • Handle non-tty scenario

Steps to Reproduce

  1. uuu -b sd <image> | tee output.txt

Example output: Spaces replaces with dots

uuu (Universal Update Utility) for nxp imx chips -- libuuu_1.5.182-7-g54b900c

Wait for Known USB Device Appear...
�[?25l
Success 0    Failure 0......................................................................................................................................................................................                                   
......................................................................................................................................................................................                                                          
......................................................................................................................................................................................                                                          
3:3-18145A0A 1/ 0 [                                      ].......................................................................................................................................................................
�[1F�[1F�[1F�[1F
Success 0    Failure 0......................................................................................................................................................................................                                   
......................................................................................................................................................................................                                                          
......................................................................................................................................................................................                                                          
3:3-18145A0A 1/ 5 [                                      ] FB: ucmd setenv fastboot_dev mmc                                                                                                                                               
�[1F�[1F�[1F�[1F
Success 0    Failure 0......................................................................................................................................................................................                                   
......................................................................................................................................................................................                                                          
......................................................................................................................................................................................     

Context (Environment)

uuu used outside of a terminal context, running through python.subprocess module (linux).

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 a pull request may close this issue.

1 participant