This commit is contained in:
Mayeul Aubin 2025-06-24 11:43:08 +02:00
parent 3aeef8fead
commit 5eefe1061c

View file

@ -64,10 +64,14 @@ def stdout_redirector(stream):
try: try:
# Create a temporary file and redirect stdout to it # Create a temporary file and redirect stdout to it
tfile = tempfile.TemporaryFile(mode="w+b") tfile = tempfile.TemporaryFile(mode="w+b")
_redirect_stdout(tfile.fileno()) _redirect_stdout(tfile.fileno())
# Yield to caller, then redirect stdout back to the saved fd # Yield to caller, then redirect stdout back to the saved fd
yield yield
_redirect_stdout(saved_stdout_fd) _redirect_stdout(saved_stdout_fd)
# Copy contents of temporary file to the given stream # Copy contents of temporary file to the given stream
tfile.flush() tfile.flush()
tfile.seek(0, io.SEEK_SET) tfile.seek(0, io.SEEK_SET)
@ -237,7 +241,7 @@ def progress_bar_from_logfile(filename:str, desc:str="", verbose:int=1, **kwargs
from tqdm import tqdm from tqdm import tqdm
from time import sleep from time import sleep
k=0 k=0
limit=600 limit=6000
update_interval=0.2 update_interval=0.2
wait_until_file_exists(filename, verbose=verbose, limit=limit) wait_until_file_exists(filename, verbose=verbose, limit=limit)
current_operation, total_operations = get_progress_from_logfile(filename) current_operation, total_operations = get_progress_from_logfile(filename)