mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-06 04:35:00 +00:00
Captured pip install output line by line, printing each line with a carriage return to overwrite, and displaying full output on failure.
This commit is contained in:
parent
24616c6c28
commit
edf2b7fc13
1 changed files with 21 additions and 4 deletions
|
@ -189,9 +189,26 @@ def pip_install(args):
|
||||||
]
|
]
|
||||||
cmd += args
|
cmd += args
|
||||||
|
|
||||||
try:
|
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1, universal_newlines=True)
|
||||||
res = subprocess.run(cmd)
|
output = []
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
print(f"Error running pip download: {e}")
|
|
||||||
|
|
||||||
return res.returncode == 0
|
try:
|
||||||
|
for line in process.stdout:
|
||||||
|
line = line.strip()
|
||||||
|
print(f"\r{line}", end='', flush=True)
|
||||||
|
output.append(line)
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print(f"\nError running pip install: {e}")
|
||||||
|
return False
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue