mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44:59 +00:00
Improved the pip_install function to handle installation output more gracefully, including printing a simple text spinner during the installation process.
This commit is contained in:
parent
edf2b7fc13
commit
0d7746c6d7
1 changed files with 15 additions and 17 deletions
|
@ -189,26 +189,24 @@ def pip_install(args):
|
|||
]
|
||||
cmd += args
|
||||
|
||||
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1, universal_newlines=True)
|
||||
output = []
|
||||
|
||||
try:
|
||||
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1, universal_newlines=True)
|
||||
output = []
|
||||
|
||||
for line in process.stdout:
|
||||
line = line.strip()
|
||||
print(f"\r{line}", end='', flush=True)
|
||||
output.append(line)
|
||||
|
||||
# todo output a simple text spinner
|
||||
|
||||
return_code = process.wait()
|
||||
|
||||
if return_code != 0:
|
||||
print("\nInstallation failed. Full output:")
|
||||
for line in output:
|
||||
print(line)
|
||||
return False
|
||||
|
||||
print() # Print a newline after successful installation
|
||||
return True
|
||||
|
||||
|
||||
if return_code == 0:
|
||||
print()
|
||||
print()
|
||||
return True
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"\nError running pip install: {e}")
|
||||
return False
|
||||
|
||||
print("\nInstallation failed. Full output:")
|
||||
for line in output:
|
||||
print(line)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue