Extra newlines on prints for non interactive terminals (Jenkins)
See original GitHub issueWe want to add alive-progress to scripts that we run as part of our pipelines. So far it seems to work well but any print we do while in the alive-progress context is getting an empty newline first. This is probably required for the interactive terminals but is distracting in the CI logs.
I wrote this snippet based on your examples:
import time
from alive_progress import alive_bar
print('Pure progress:')
with alive_bar(1000) as bar:
for i in range(1000):
time.sleep(0.01)
bar()
print('With extra output:')
with alive_bar(1000) as bar:
for i in range(1000):
if i% 300 == 0:
print('found')
time.sleep(0.01)
bar()
This is the output on our CI system (Jenkins with timestamps enabled):
01:07:58 + python alive.py
01:07:58 Pure progress:
01:08:08 |ββββββββββββββββββββββββββββββββββββββββ| 1000/1000 [100%] in 10.1s (99.39/s)
01:08:08 With extra output:
01:08:08
on 0: found
01:08:12
on 300: found
01:08:15
on 600: found
01:08:17
on 900: found
01:08:18 |ββββββββββββββββββββββββββββββββββββββββ| 1000/1000 [100%] in 10.1s (99.38/s)
Ideally it should be:
01:07:58 + python alive.py
01:07:58 Pure progress:
01:08:08 |ββββββββββββββββββββββββββββββββββββββββ| 1000/1000 [100%] in 10.1s (99.39/s)
01:08:08 With extra output:
01:08:08 on 0: found
01:08:12 on 300: found
01:08:15 on 600: found
01:08:17 on 900: found
01:08:18 |ββββββββββββββββββββββββββββββββββββββββ| 1000/1000 [100%] in 10.1s (99.38/s)
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
How to add new lines when using echo - Unix Stack Exchange
When executing echo -e "package main\nversion = \"0.0.16\"" > version.go in a Makefile on Alpine 3.12 and make 4.3, it will write -e...
Read more >jenkins pipeline sh adding new line - groovy - Stack Overflow
This lets you insert newlines to format a long command. Wrap variables with double quotes (valid within triple double quotes,Β ...
Read more >docker outputs to standard out with added carriage return ...
I am not seeing the extra carriage returns described. Is there a simple repro other than docker run --rm busybox echo "Hello World"...
Read more >Running Multi-Line Shell Code at Once From Single Prompt
There are many ways to run multi-line shell commands in Linux at once. Let's explore and compare them.
Read more >Jenkins User Handbook
configure Docker so it can be managed as a non-root user. Read more about this ... Open up a terminal/command prompt window to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Great! Thank you for the report. So 2.0 will already ship with this! Donβt forget to check often this repo, to switch to the oficial 2.0 version as soon as it is released! Iβm just writing the new README now π
Perfect now π
https://user-images.githubusercontent.com/1504511/119917708-eca21700-bf1b-11eb-8faf-736a48e9553e.mp4