mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
Updated the spinner to update 5 times per second.
This commit is contained in:
parent
6b56a31afc
commit
bc1369c480
1 changed files with 6 additions and 7 deletions
|
@ -3,6 +3,7 @@ import os
|
|||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import git
|
||||
|
@ -207,22 +208,20 @@ def run_install(cmd):
|
|||
universal_newlines=True,
|
||||
)
|
||||
spinner = itertools.cycle(["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"])
|
||||
char_count = 0
|
||||
current_line = ""
|
||||
last_update = time.time()
|
||||
update_interval = 0.2 # 5 times per second
|
||||
|
||||
while True:
|
||||
char = process.stdout.read(1)
|
||||
if not char:
|
||||
break
|
||||
|
||||
current_line += char
|
||||
char_count += 1
|
||||
output.append(char)
|
||||
|
||||
if char == '\n' or char_count >= 10:
|
||||
current_time = time.time()
|
||||
if current_time - last_update >= update_interval:
|
||||
print(f" Installing... {next(spinner)}", end="\r", flush=True)
|
||||
char_count = 0
|
||||
current_line = ""
|
||||
last_update = current_time
|
||||
|
||||
return_code = process.wait()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue