mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09: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 subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import git
|
import git
|
||||||
|
@ -207,22 +208,20 @@ def run_install(cmd):
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
)
|
)
|
||||||
spinner = itertools.cycle(["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"])
|
spinner = itertools.cycle(["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"])
|
||||||
char_count = 0
|
last_update = time.time()
|
||||||
current_line = ""
|
update_interval = 0.2 # 5 times per second
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
char = process.stdout.read(1)
|
char = process.stdout.read(1)
|
||||||
if not char:
|
if not char:
|
||||||
break
|
break
|
||||||
|
|
||||||
current_line += char
|
|
||||||
char_count += 1
|
|
||||||
output.append(char)
|
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)
|
print(f" Installing... {next(spinner)}", end="\r", flush=True)
|
||||||
char_count = 0
|
last_update = current_time
|
||||||
current_line = ""
|
|
||||||
|
|
||||||
return_code = process.wait()
|
return_code = process.wait()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue